Tell the linker to not treat its input as Objective C/C++ source.

Flags in CMAKE_CXX_FLAGS are passed to both compile and link commands.

A cleaner solution would be to use set_source_files_properties().
However, currently there are headers (StdThread.h, maybe more) that contain
Objective syntax. So it is not easy to determine exactly which source files
should be compiled as Objective C/C++ and that set can quickly change when
certain #include directives are modified. The solution for that would be to
move all uses of Objective syntax to implementation (.cpp) files and then
apply set_source_files_properties() to those.
This commit is contained in:
Maarten ter Huurne 2011-12-05 00:57:51 +01:00
parent d249ee599a
commit 7417ecf67f

View File

@ -102,6 +102,7 @@ endif()
if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -x objective-c++")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -x objective-c")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -x none")
FIND_LIBRARY(ATB_LIBRARY AudioToolbox)
FIND_LIBRARY(AU_LIBRARY AudioUnit)
FIND_LIBRARY(CARBON_LIBRARY Carbon)