diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-05 14:28:43 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-05 14:28:43 (GMT) |
commit | eab5a4350d45fe228ad143cf481c52c26feacef3 (patch) | |
tree | 88282dc5469f70e84600628781ada218ac9a4042 /Modules/CMakeDetermineSystem.cmake | |
parent | 6989f80026498fa24134143b30adf8a909aba51d (diff) | |
download | CMake-eab5a4350d45fe228ad143cf481c52c26feacef3.zip CMake-eab5a4350d45fe228ad143cf481c52c26feacef3.tar.gz CMake-eab5a4350d45fe228ad143cf481c52c26feacef3.tar.bz2 |
ENH: also load a processor-specific file if exists
-also try the basename file if the compiler id file doesn't exist
-don't rely so much on the CMAKE_TOOLCHAIN_FILE
Alex
Diffstat (limited to 'Modules/CMakeDetermineSystem.cmake')
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 1da8cb4..580d832 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -77,19 +77,25 @@ IF(CMAKE_TOOLCHAIN_FILE) ELSE(_INCLUDED_TOOLCHAIN_FILE) MESSAGE(FATAL_ERROR "Could not find toolchain file: ${CMAKE_TOOLCHAIN_FILE}") ENDIF(_INCLUDED_TOOLCHAIN_FILE) +ENDIF(CMAKE_TOOLCHAIN_FILE) + +# if CMAKE_SYSTEM_NAME is here already set, either it comes from a toolchain file +# or it was set via -DCMAKE_SYSTEM_NAME=... +# if that's the case, assume we are crosscompiling +IF(CMAKE_SYSTEM_NAME) IF(NOT DEFINED CMAKE_CROSSCOMPILING) SET(CMAKE_CROSSCOMPILING TRUE) ENDIF(NOT DEFINED CMAKE_CROSSCOMPILING) - -ELSE(CMAKE_TOOLCHAIN_FILE) - + SET(PRESET_CMAKE_SYSTEM_NAME TRUE) +ELSE(CMAKE_SYSTEM_NAME) SET(CMAKE_SYSTEM_NAME "${CMAKE_HOST_SYSTEM_NAME}") SET(CMAKE_SYSTEM_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") SET(CMAKE_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") SET(CMAKE_CROSSCOMPILING FALSE) + SET(PRESET_CMAKE_SYSTEM_NAME FALSE) +ENDIF(CMAKE_SYSTEM_NAME) -ENDIF(CMAKE_TOOLCHAIN_FILE) MACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) IF(NOT ${_PREFIX}_NAME) @@ -118,14 +124,22 @@ ENDMACRO(ADJUST_CMAKE_SYSTEM_VARIABLES _PREFIX) ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_SYSTEM) ADJUST_CMAKE_SYSTEM_VARIABLES(CMAKE_HOST_SYSTEM) +# write entry to the log file +IF(PRESET_CMAKE_SYSTEM_NAME) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n") +ELSE(PRESET_CMAKE_SYSTEM_NAME) + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "The system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") +ENDIF(PRESET_CMAKE_SYSTEM_NAME) + + # if a toolchain file is used use configure_file() to copy it into the # build tree, because this way e.g. ${CMAKE_SOURCE_DIR} will be replaced # with its full path, and so it will also work when used in try_compile() IF (CMAKE_TOOLCHAIN_FILE) - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "The target system is: ${CMAKE_SYSTEM_NAME} - ${CMAKE_SYSTEM_VERSION} - ${CMAKE_SYSTEM_PROCESSOR}\n") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "The host system is: ${CMAKE_HOST_SYSTEM_NAME} - ${CMAKE_HOST_SYSTEM_VERSION} - ${CMAKE_HOST_SYSTEM_PROCESSOR}\n") SET(_OWN_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) CONFIGURE_FILE(${CMAKE_TOOLCHAIN_FILE} @@ -134,10 +148,7 @@ IF (CMAKE_TOOLCHAIN_FILE) CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake IMMEDIATE @ONLY) - ELSE (CMAKE_TOOLCHAIN_FILE) - 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, the template file is defined at the top of this file CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in |