diff options
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCCompiler.cmake | 3 | ||||
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 11 | ||||
-rw-r--r-- | Modules/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Modules/CMakeSystem.cmake.in | 23 | ||||
-rw-r--r-- | Modules/CMakeSystemWithToolchainFile.cmake.in | 11 |
5 files changed, 28 insertions, 22 deletions
diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index fd46bd6..b3c7c6c 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -62,6 +62,9 @@ IF(NOT CMAKE_C_COMPILER) ENDIF(CMAKE_C_COMPILER_INIT AND NOT CMAKE_C_COMPILER) ELSE(NOT CMAKE_C_COMPILER) + # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # # if a compiler was specified by the user but without path, # now try to find it with the full path # if it is found, force it into the cache, diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 311a21d..5a91a30 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -26,6 +26,10 @@ # cygwin CYGWIN_NT-5.1 # MacOSX Darwin + +#set the source file which will be configured to become CMakeSystem.cmake +SET(_CMAKE_SYSTEM_TEMPLATE_FILE ${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in ) + IF(CMAKE_TOOLCHAIN_FILE) # at first try to load it as path relative to the directory from which cmake has been run INCLUDE("${CMAKE_BINARY_DIR}/${CMAKE_TOOLCHAIN_FILE}" OPTIONAL RESULT_VARIABLE _INCLUDED_TOOLCHAIN_FILE) @@ -40,6 +44,9 @@ IF(CMAKE_TOOLCHAIN_FILE) MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}") ENDIF(_INCLUDED_TOOLCHAIN_FILE) + # use a different source file for CMakeSystem.cmake, since it has to hold a bit more information + SET(_CMAKE_SYSTEM_TEMPLATE_FILE ${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in ) + IF(NOT DEFINED CMAKE_CROSSCOMPILING) SET(CMAKE_CROSSCOMPILING TRUE) ENDIF(NOT DEFINED CMAKE_CROSSCOMPILING) @@ -105,8 +112,8 @@ ENDIF(CMAKE_SYSTEM_VERSION) FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") -# configure variables set in this file for fast reload -CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in +# configure variables set in this file for fast reload, the template file is defined at the top of this file +CONFIGURE_FILE(${_CMAKE_SYSTEM_TEMPLATE_FILE} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake IMMEDIATE @ONLY) diff --git a/Modules/CMakeLists.txt b/Modules/CMakeLists.txt index c3b5903..c575043 100644 --- a/Modules/CMakeLists.txt +++ b/Modules/CMakeLists.txt @@ -1,5 +1,5 @@ # just install the modules -# new file added, force rerunning cmake +# new file added, force rerunning cmake # SUBDIRS(Platform) INSTALL_FILES(${CMAKE_DATA_DIR}/Modules .*\\.cmake$) diff --git a/Modules/CMakeSystem.cmake.in b/Modules/CMakeSystem.cmake.in index 0fbf387..785f197 100644 --- a/Modules/CMakeSystem.cmake.in +++ b/Modules/CMakeSystem.cmake.in @@ -1,21 +1,6 @@ -IF("@CMAKE_TOOLCHAIN_FILE@" STREQUAL "") - - SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@") - SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") - SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") - SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") - -ELSE("@CMAKE_TOOLCHAIN_FILE@" STREQUAL "") - - INCLUDE("@CMAKE_TOOLCHAIN_FILE@") - -# set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME - SET(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}) -# if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION} - IF(CMAKE_SYSTEM_VERSION) - SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}) - ENDIF(CMAKE_SYSTEM_VERSION) - -ENDIF("@CMAKE_TOOLCHAIN_FILE@" STREQUAL "") +SET(CMAKE_SYSTEM "@CMAKE_SYSTEM@") +SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") +SET(CMAKE_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@") +SET(CMAKE_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@") SET(CMAKE_SYSTEM_LOADED 1) diff --git a/Modules/CMakeSystemWithToolchainFile.cmake.in b/Modules/CMakeSystemWithToolchainFile.cmake.in new file mode 100644 index 0000000..b86a810 --- /dev/null +++ b/Modules/CMakeSystemWithToolchainFile.cmake.in @@ -0,0 +1,11 @@ + +INCLUDE("@CMAKE_TOOLCHAIN_FILE@") + +# set CMAKE_SYSTEM to the CMAKE_SYSTEM_NAME +SET(CMAKE_SYSTEM ${CMAKE_SYSTEM_NAME}) +# if there is a CMAKE_SYSTEM_VERSION then add a -${CMAKE_SYSTEM_VERSION} +IF(CMAKE_SYSTEM_VERSION) + SET(CMAKE_SYSTEM ${CMAKE_SYSTEM}-${CMAKE_SYSTEM_VERSION}) +ENDIF(CMAKE_SYSTEM_VERSION) + +SET(CMAKE_SYSTEM_LOADED 1) |