Changeset 8351 for code/trunk/cmake/CompilerConfigGCC.cmake
- Timestamp:
- Apr 28, 2011, 7:15:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/cmake/CompilerConfigGCC.cmake
r7458 r8351 26 26 INCLUDE(FlagUtilities) 27 27 INCLUDE(CompareVersionStrings) 28 INCLUDE(CheckCXXCompilerFlag) 28 29 29 30 # Shortcut for CMAKE_COMPILER_IS_GNUCXX and ..._GNUC … … 36 37 OUTPUT_VARIABLE GCC_VERSION 37 38 ) 38 39 # Complain about incompatibilities40 COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.4.0" _compare_result)41 IF(NOT _compare_result LESS 0)42 IF(${Boost_VERSION} LESS 103700)43 MESSAGE(STATUS "Warning: Boost versions earlier than 1.37 may not compile with GCC 4.4 or later!")44 ENDIF()45 ENDIF()46 47 # GCC may not support #pragma GCC system_header correctly when using48 # templates. According to Bugzilla, it was fixed March 07 but tests49 # have confirmed that GCC 4.0.0 does not pose a problem for our cases.50 COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.0.0" _compare_result)51 IF(_compare_result LESS 0)52 SET(GCC_NO_SYSTEM_HEADER_SUPPORT TRUE)53 ENDIF()54 39 55 40 # GCC only supports PCH in versions 3.4 and above … … 72 57 73 58 # CMake doesn't seem to set the PIC flags right on certain 64 bit systems 74 IF( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")59 IF(NOT MINGW AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64") 75 60 ADD_COMPILER_FLAGS("-fPIC" CACHE) 61 ENDIF() 62 63 # Enable non standard floating point optimisations 64 ADD_COMPILER_FLAGS("-ffast-math" CACHE) 65 66 # Use SSE if possible 67 # Commented because this might not work for cross compiling 68 #CHECK_CXX_COMPILER_FLAG(-msse _gcc_have_sse) 69 #IF(_gcc_have_sse) 70 # ADD_COMPILER_FLAGS("-msse" CACHE) 71 #ENDIF() 72 73 IF(NOT MINGW) 74 # Have GCC visibility? 75 CHECK_CXX_COMPILER_FLAG("-fvisibility=hidden" _gcc_have_visibility) 76 IF(_gcc_have_visibility) 77 # Note: There is a possible bug with the flag in gcc < 4.2 and Debug versions 78 COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.2.0" _compare_result) 79 IF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug" OR _compare_result GREATER -1) 80 ADD_COMPILER_FLAGS("-DORXONOX_GCC_VISIBILITY -fvisibility=default -fvisibility-inlines-hidden" CACHE) 81 ENDIF() 82 ENDIF(_gcc_have_visibility) 76 83 ENDIF() 77 84 78 85 # We have some unconformant code, disable an optimisation feature 79 86 ADD_COMPILER_FLAGS("-fno-strict-aliasing" CACHE) 80 81 # For GCC older than version 4, do not display sign compare warnings82 # because of boost::filesystem (which creates about a hundred per include)83 ADD_COMPILER_FLAGS("-Wno-sign-compare" GCC_NO_SYSTEM_HEADER_SUPPORT CACHE)84 87 85 88 # For newer GCC (4.3 and above), don't display hundreds of annoying deprecated … … 98 101 ENDIF() 99 102 100 # General linker flags 101 SET_LINKER_FLAGS("--no-undefined" CACHE) 103 # Linker flags 104 IF(LINUX) 105 # Don't allow undefined symbols in a shared library 106 SET_LINKER_FLAGS("-Wl,--no-undefined" CACHE) 107 ENDIF() 102 108 103 109 # Add compiler and linker flags for MinGW
Note: See TracChangeset
for help on using the changeset viewer.