summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineSystem.cmake
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-05-22 16:48:16 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-05-22 16:48:16 (GMT)
commit6e2fd2c2cade2d8397dbdcd104d10654c2ff6c65 (patch)
tree80d10867c3f9f7ce441104808d284a913c16627f /Modules/CMakeDetermineSystem.cmake
parentbef8d3580b32987486c67cf0eed73fe3d11472d3 (diff)
downloadCMake-6e2fd2c2cade2d8397dbdcd104d10654c2ff6c65.zip
CMake-6e2fd2c2cade2d8397dbdcd104d10654c2ff6c65.tar.gz
CMake-6e2fd2c2cade2d8397dbdcd104d10654c2ff6c65.tar.bz2
BUG: now the toolchain file is configured into the buildtree, otherwise e.g.
CMAKE_SOURCE_DIR can't be used there ENH: modify CMakeCCompilerId.c and .h so that sdcc can compile them. As they were the preprocessor produced: 9 "test.c" static char const info_compiler[] = "INFO:compiler[" # 40 "test.c" "" "]"; and the mixing of the preprocessing directives and the string constants didn't work. Alex
Diffstat (limited to 'Modules/CMakeDetermineSystem.cmake')
-rw-r--r--Modules/CMakeDetermineSystem.cmake25
1 files changed, 17 insertions, 8 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 5a91a30..e47ea15 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -27,9 +27,6 @@
# 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)
@@ -44,9 +41,6 @@ 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)
@@ -112,8 +106,23 @@ 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, the template file is defined at the top of this file
-CONFIGURE_FILE(${_CMAKE_SYSTEM_TEMPLATE_FILE}
+# 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)
+ SET(_OWN_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY})
+ CONFIGURE_FILE(${CMAKE_TOOLCHAIN_FILE}
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeToolchainFile.cmake)
+
+ CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CMakeSystemWithToolchainFile.cmake.in
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
IMMEDIATE @ONLY)
+ELSE (CMAKE_TOOLCHAIN_FILE)
+
+ # 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
+ ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake
+ IMMEDIATE @ONLY)
+
+ENDIF (CMAKE_TOOLCHAIN_FILE)