Add some support for the clang compiler.
It fails to link some standard libraries. Forcing files to be C++ files doesn't set the proper compiler switches for clang. Tested with clang 2.9, there are still compilation errors to be sorted out.
This commit is contained in:
parent
e398b69bf8
commit
6e49fbb15d
2 changed files with 12 additions and 1 deletions
|
@ -132,6 +132,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
|
|||
|
||||
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
if(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Assume the compiler is the clang compiler.
|
||||
set(CMAKE_EXE_LINKER_FLAGS "-lstdc++ -lm ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
endif(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# compose datadir path of datarootdir and datadirname
|
||||
set(DATADIR ${DATAROOTDIR}/${DATADIRNAME})
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ if(ZLIB_INCLUDE_DIR)
|
|||
include_directories( ${ZLIB_INCLUDE_DIR} )
|
||||
endif()
|
||||
|
||||
|
||||
set(network_implementation_files network.cpp network_worker.cpp)
|
||||
|
||||
if(USE_ANA_NETWORK)
|
||||
|
@ -271,6 +270,13 @@ set(libwesnoth-lua_STAT_SRC
|
|||
# We explicitly want lua compiled as C++ version, so this line is required:
|
||||
set_source_files_properties(${libwesnoth-lua_STAT_SRC} PROPERTIES LANGUAGE CXX)
|
||||
|
||||
if(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Assume the compiler is the clang compiler.
|
||||
# It needs the files to be forced as c++ manually, it might be a newer
|
||||
# version of cmake will be able to this for us.
|
||||
set_source_files_properties(${libwesnoth-lua_STAT_SRC} PROPERTIES COMPILE_FLAGS "-x c++")
|
||||
endif(UNIX AND NOT CMAKE_COMPILER_IS_GNUCXX)
|
||||
|
||||
# a 'lib' is automatically set in front when creating the library (as in the filename)
|
||||
# internal reference is the name given here
|
||||
add_library(wesnoth-lua STATIC EXCLUDE_FROM_ALL ${libwesnoth-lua_STAT_SRC})
|
||||
|
|
Loading…
Add table
Reference in a new issue