mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-25 10:18:34 -06:00
OBJCXX: Fix regression for compiling cpp files as objcxx
In commit 8d61294c3e (PCH: Mark CMake PCH source files as -x
<lang>-header, 2020-09-04, v3.18.3~14^2) we removed the explicit `-x
objective-c++` flag. This broke cases with custom source extensions.
Restore the explicit `-x objective-c[++]` flag and put it before the
`<FLAGS>` placeholder. The latter will contain the proper `-x
objective-c[++]-header` value and will override the `-x objective-c[++]`
value set before.
Fixes: #21234
This commit is contained in:
@@ -170,7 +170,7 @@ endif()
|
||||
# compile an Objective-C file into an object file
|
||||
if(NOT CMAKE_OBJC_COMPILE_OBJECT)
|
||||
set(CMAKE_OBJC_COMPILE_OBJECT
|
||||
"<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -x objective-c -o <OBJECT> -c <SOURCE>")
|
||||
"<CMAKE_OBJC_COMPILER> <DEFINES> <INCLUDES> -x objective-c <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OBJC_LINK_EXECUTABLE)
|
||||
|
||||
@@ -263,7 +263,7 @@ endif()
|
||||
# compile an Objective-C++ file into an object file
|
||||
if(NOT CMAKE_OBJCXX_COMPILE_OBJECT)
|
||||
set(CMAKE_OBJCXX_COMPILE_OBJECT
|
||||
"<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
"<CMAKE_OBJCXX_COMPILER> <DEFINES> <INCLUDES> -x objective-c++ <FLAGS> -o <OBJECT> -c <SOURCE>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_OBJCXX_LINK_EXECUTABLE)
|
||||
|
||||
Reference in New Issue
Block a user