diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-05-29 15:36:07 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-05-29 15:36:07 (GMT) |
commit | eed7c8dec14a37660ed0bf74cac3bfd0221c1f5b (patch) | |
tree | 11ea16396d43457af188ba90237ed12b196f26cf /Tests/CMakeTests/ToolchainTest.cmake.in | |
parent | cfee916b7c90bafa372ff86f2b21d5800fc8bc99 (diff) | |
download | CMake-eed7c8dec14a37660ed0bf74cac3bfd0221c1f5b.zip CMake-eed7c8dec14a37660ed0bf74cac3bfd0221c1f5b.tar.gz CMake-eed7c8dec14a37660ed0bf74cac3bfd0221c1f5b.tar.bz2 |
ENH: always provide CMAKE_SYSTEM_XXX() and MAKE_HOST_SYSTEM_XXX() variables,
so when cross compiling the build host platform can be tested
Alex
Diffstat (limited to 'Tests/CMakeTests/ToolchainTest.cmake.in')
-rw-r--r-- | Tests/CMakeTests/ToolchainTest.cmake.in | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index 7d59118..577894b 100644 --- a/Tests/CMakeTests/ToolchainTest.cmake.in +++ b/Tests/CMakeTests/ToolchainTest.cmake.in @@ -15,6 +15,45 @@ set(CMAKE_CXX_COMPILER_ID_RUN 1) set(MY_SOURCE_DIR "@CMAKE_CURRENT_SOURCE_DIR@") +# at first load CMakeDetermineSystem.cmake without toolchain file +set(CMAKE_TOOLCHAIN_FILE) +include(CMakeDetermineSystem) + +# check that CMAKE_SYSTEM_XXX and CMAKE_HOST_SYSTEM_xxx are identical +if(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") + message(FATAL_ERROR "CMAKE_SYSTEM_NAME and CMAKE_HOST_SYSTEM_NAME not identical: \"${CMAKE_SYSTEM_NAME}\" vs. \"${CMAKE_HOST_SYSTEM_NAME}\"") +endif(NOT "${CMAKE_SYSTEM_NAME}" STREQUAL "${CMAKE_HOST_SYSTEM_NAME}") + +if(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") + message(FATAL_ERROR "CMAKE_SYSTEM and CMAKE_HOST_SYSTEM not identical: \"${CMAKE_SYSTEM}\" vs. \"${CMAKE_HOST_SYSTEM}\"") +endif(NOT "${CMAKE_SYSTEM}" STREQUAL "${CMAKE_HOST_SYSTEM}") + +if(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") + message(FATAL_ERROR "CMAKE_SYSTEM_VERSION and CMAKE_HOST_SYSTEM_VERSION not identical: \"${CMAKE_SYSTEM_VERSION}\" vs. \"${CMAKE_HOST_SYSTEM_VERSION}\"") +endif(NOT "${CMAKE_SYSTEM_VERSION}" STREQUAL "${CMAKE_HOST_SYSTEM_VERSION}") + +if(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "CMAKE_SYSTEM_PROCESSOR and CMAKE_HOST_SYSTEM_PROCESSOR not identical: \"${CMAKE_SYSTEM_PROCESSOR}\" vs. \"${CMAKE_HOST_SYSTEM_PROCESSOR}\"") +endif(NOT "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}") + +# save the values so we can compare them to CMAKE_HOST_SYSTEM_XXX in the toolchain case + +set(NATIVE_SYSTEM "${CMAKE_SYSTEM}") +set(NATIVE_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}") +set(NATIVE_SYSTEM_VERSION "${CMAKE_SYSTEM_VERSION}") +set(NATIVE_SYSTEM_PROCESSOR "${CMAKE_SYSTEM_PROCESSOR}") + +# reset them so they will be detected again now +set(CMAKE_SYSTEM) +set(CMAKE_SYSTEM_NAME) +set(CMAKE_SYSTEM_VERSION) +set(CMAKE_SYSTEM_PROCESSOR) +set(CMAKE_HOST_SYSTEM) +set(CMAKE_HOST_SYSTEM_NAME) +set(CMAKE_HOST_SYSTEM_VERSION) +set(CMAKE_HOST_SYSTEM_PROCESSOR) + + ############################################################ # now define a toolchain file and check that everything is @@ -42,6 +81,21 @@ if(NOT "${_INCLUDED_TOOLCHAIN_FILE}" STREQUAL "${MY_SOURCE_DIR}/DummyToolchain.c message(FATAL_ERROR "wrong toolchain file loaded: \"${_INCLUDED_TOOLCHAIN_FILE}\", expected: \"${MY_SOURCE_DIR}/DummyToolchain.cmake\"") endif(NOT "${_INCLUDED_TOOLCHAIN_FILE}" STREQUAL "${MY_SOURCE_DIR}/DummyToolchain.cmake") + +# check that CMAKE_HOST_SYSTEM_XXX and _SYSTEM_xxx detected above are identical +if(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") + message(FATAL_ERROR "CMAKE_HOST_SYSTEM_NAME and NATIVE_SYSTEM_NAME not identical: \"${CMAKE_HOST_SYSTEM_NAME}\" vs. \"${NATIVE_SYSTEM_NAME}\"") +endif(NOT "${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "${NATIVE_SYSTEM_NAME}") +if(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") + message(FATAL_ERROR "CMAKE_HOST_SYSTEM and NATIVE_SYSTEM not identical: \"${CMAKE_HOST_SYSTEM}\" vs. \"${NATIVE_SYSTEM}\"") +endif(NOT "${CMAKE_HOST_SYSTEM}" STREQUAL "${NATIVE_SYSTEM}") +if(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") + message(FATAL_ERROR "CMAKE_HOST_SYSTEM_VERSION and NATIVE_SYSTEM_VERSION not identical: \"${CMAKE_HOST_SYSTEM_VERSION}\" vs. \"${NATIVE_SYSTEM_VERSION}\"") +endif(NOT "${CMAKE_HOST_SYSTEM_VERSION}" STREQUAL "${NATIVE_SYSTEM_VERSION}") +if(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") + message(FATAL_ERROR "CMAKE_HOST_SYSTEM_PROCESSOR and NATIVE_SYSTEM_PROCESSOR not identical: \"${CMAKE_HOST_SYSTEM_PROCESSOR}\" vs. \"${NATIVE_SYSTEM_PROCESSOR}\"") +endif(NOT "${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "${NATIVE_SYSTEM_PROCESSOR}") + ############################################################# # check the results from DetermineCCompiler |