2 # This file is included by cmGlobalGenerator::EnableLanguage.
3 # It is included after the compiler has been determined, so
4 # we know things like the compiler name and if the compiler is gnu.
6 # before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
7 # done to keep scripts and custom language and compiler modules working.
8 # But they are reset here and set again in the platform files for the target
9 # platform, so they can be used for testing the target platform instead
10 # of testing the host platform.
17 # include Generic system information
18 INCLUDE(CMakeGenericSystem)
20 # 2. now include SystemName.cmake file to set the system specific information
21 SET(CMAKE_SYSTEM_INFO_FILE Platform/${CMAKE_SYSTEM_NAME})
23 INCLUDE(${CMAKE_SYSTEM_INFO_FILE} OPTIONAL RESULT_VARIABLE _INCLUDED_SYSTEM_INFO_FILE)
25 IF(NOT _INCLUDED_SYSTEM_INFO_FILE)
26 MESSAGE("System is unknown to cmake, create:\n${CMAKE_SYSTEM_INFO_FILE}"
27 " to use this system, please send your config file to "
28 "cmake@www.cmake.org so it can be added to cmake")
29 IF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
30 CONFIGURE_FILE(${CMAKE_BINARY_DIR}/CMakeCache.txt
31 ${CMAKE_BINARY_DIR}/CopyOfCMakeCache.txt COPYONLY)
32 MESSAGE("Your CMakeCache.txt file was copied to CopyOfCMakeCache.txt. "
33 "Please send that file to cmake@www.cmake.org.")
34 ENDIF(EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt)
35 ENDIF(NOT _INCLUDED_SYSTEM_INFO_FILE)
38 # The Eclipse generator needs to know the standard include path
39 # so that Eclipse ca find the headers at runtime and parsing etc. works better
40 # This is done here by actually running gcc with the options so it prints its
41 # system include directories, which are parsed then and stored in the cache.
42 IF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse")
44 MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _result)
47 FILE(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n" )
48 EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -v -E -x ${_lang} dummy
49 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles
50 ERROR_VARIABLE _gccOutput
52 FILE(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
54 IF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" )
55 SET(${_result} ${CMAKE_MATCH_1})
56 STRING(REPLACE "\n" " " ${_result} "${${_result}}")
57 SEPARATE_ARGUMENTS(${_result})
58 ENDIF( "${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list" )
59 ENDMACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang)
62 IF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS)
63 _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c _dirs)
64 SET(CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "C compiler system include directories")
65 ENDIF ("${CMAKE_C_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_C_SYSTEM_INCLUDE_DIRS)
67 # And now the same for C++
68 IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS)
69 _DETERMINE_GCC_SYSTEM_INCLUDE_DIRS(c++ _dirs)
70 SET(CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS "${_dirs}" CACHE INTERNAL "CXX compiler system include directories")
71 ENDIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU AND NOT CMAKE_ECLIPSE_CXX_SYSTEM_INCLUDE_DIRS)
73 ENDIF("${CMAKE_EXTRA_GENERATOR}" MATCHES "Eclipse")
76 # for most systems a module is the same as a shared library
77 # so unless the variable CMAKE_MODULE_EXISTS is set just
78 # copy the values from the LIBRARY variables
79 # this has to be done after the system information has been loaded
80 IF(NOT CMAKE_MODULE_EXISTS)
81 SET(CMAKE_SHARED_MODULE_PREFIX "${CMAKE_SHARED_LIBRARY_PREFIX}")
82 SET(CMAKE_SHARED_MODULE_SUFFIX "${CMAKE_SHARED_LIBRARY_SUFFIX}")
83 SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG})
84 SET(CMAKE_SHARED_MODULE_RUNTIME_C_FLAG_SEP ${CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP})
85 ENDIF(NOT CMAKE_MODULE_EXISTS)
88 SET(CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED 1)