diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-08-09 18:45:23 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-08-09 18:45:23 (GMT) |
commit | 176fe63d151d60e90edd4bd01eaac7d1b74241cd (patch) | |
tree | d6967d87757696ce05396c62f75e98da63f9b91c /Modules | |
parent | 9bd32386c266c906c1a4c02964dfa68292c4ab12 (diff) | |
download | CMake-176fe63d151d60e90edd4bd01eaac7d1b74241cd.zip CMake-176fe63d151d60e90edd4bd01eaac7d1b74241cd.tar.gz CMake-176fe63d151d60e90edd4bd01eaac7d1b74241cd.tar.bz2 |
ENH: UNIX, CYGWIN, WIN32, APPLE, QNXNTO and BEOS are not longer set in
cmMakefile.cxx, but now in the platform files and are now valid for the
target platform, not the host platform.
New variables CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE and
CMAKE_HOST_CYGWIN have been added in cmMakefile.cxx (...and have now to be
used in all cmake files which are executed before
CMakeSystemSpecificInformation.cmake is loaded). For compatibility the old
set is set to the new one in CMakeDetermineSystem.cmake and reset before the
system platform files are loaded, so custom language or compiler modules
which use these should still work.
Alex
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 4 | ||||
-rw-r--r-- | Modules/CMakeDetermineSystem.cmake | 23 | ||||
-rw-r--r-- | Modules/CMakeSystemSpecificInformation.cmake | 11 | ||||
-rw-r--r-- | Modules/Platform/BeOS.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/CYGWIN.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/QNX.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/UnixPaths.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows.cmake | 2 |
9 files changed, 44 insertions, 7 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 9418293..4179a49 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -6,13 +6,13 @@ MACRO(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) # Store the compiler identification source file. SET(CMAKE_${lang}_COMPILER_ID_SRC "${src}") - IF(WIN32 AND NOT CYGWIN) + IF(CMAKE_HOST_WIN32 AND NOT CMAKE_HOST_CYGWIN) # This seems to escape spaces: #FILE(TO_NATIVE_PATH "${CMAKE_${lang}_COMPILER_ID_SRC}" # CMAKE_${lang}_COMPILER_ID_SRC) STRING(REGEX REPLACE "/" "\\\\" CMAKE_${lang}_COMPILER_ID_SRC "${CMAKE_${lang}_COMPILER_ID_SRC}") - ENDIF(WIN32 AND NOT CYGWIN) + ENDIF(CMAKE_HOST_WIN32 AND NOT CMAKE_HOST_CYGWIN) # Make sure user-specified compiler flags are used. IF(CMAKE_${lang}_FLAGS) diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 09752ee..7e6a6dd 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -28,7 +28,7 @@ # find out on which system cmake runs -IF(UNIX) +IF(CMAKE_HOST_UNIX) FIND_PROGRAM(CMAKE_UNAME uname /bin /usr/bin /usr/local/bin ) IF(CMAKE_UNAME) EXEC_PROGRAM(uname ARGS -s OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_NAME) @@ -53,12 +53,25 @@ IF(UNIX) STRING(REGEX REPLACE "\"" "" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") STRING(REGEX REPLACE "/" "_" CMAKE_HOST_SYSTEM_PROCESSOR "${CMAKE_HOST_SYSTEM_PROCESSOR}") ENDIF(CMAKE_UNAME) -ELSE(UNIX) - IF(WIN32) +ELSE(CMAKE_HOST_UNIX) + IF(CMAKE_HOST_WIN32) SET (CMAKE_HOST_SYSTEM_NAME "Windows") SET (CMAKE_HOST_SYSTEM_PROCESSOR "$ENV{PROCESSOR_ARCHITECTURE}") - ENDIF(WIN32) -ENDIF(UNIX) + ENDIF(CMAKE_HOST_WIN32) +ENDIF(CMAKE_HOST_UNIX) + +# this is for compatibility +# with cmake 2.4 these variables were compiled in +# now that cmake has to separate between host and target platform +# two sets are needed. For compatibility the old set of variables is here +# set to the compiled-in values, so they still work in custom +# language or compiler modules where they might be used. +# After that they are reset in CMakeSystemSpecificInformation.cmake +# and then set according to the current target platform in the Modules/${CMAKE_SYSTEM_NAME}.cmake file +SET(APPLE ${CMAKE_HOST_APPLE}) +SET(UNIX ${CMAKE_HOST_UNIX}) +SET(CYGWIN ${CMAKE_HOST_CYGWIN}) +SET(WIN32 ${CMAKE_HOST_WIN32}) # if a toolchain file is used, the user wants to cross compile. # in this case read the toolchain file and keep the CMAKE_HOST_SYSTEM_* diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake index 37e31c9..c0af01a 100644 --- a/Modules/CMakeSystemSpecificInformation.cmake +++ b/Modules/CMakeSystemSpecificInformation.cmake @@ -3,6 +3,17 @@ # It is included after the compiler has been determined, so # we know things like the compiler name and if the compiler is gnu. +# before cmake 2.6 these variables were compiled-in in cmake +# now they are set in the Modules/${CMAKE_SYSTEM_NAME}.cmake file +# In order to keep custom language or compiler files working which might use +# these variables, they are set to the value of the compiled-in variables in +# CMakeDetermineSystem.cmake and reset here. +SET(APPLE ) +SET(UNIX ) +SET(CYGWIN ) +SET(WIN32 ) + + # include Generic system information INCLUDE(CMakeGenericSystem) diff --git a/Modules/Platform/BeOS.cmake b/Modules/Platform/BeOS.cmake index 13c4016..0cbb90f 100644 --- a/Modules/Platform/BeOS.cmake +++ b/Modules/Platform/BeOS.cmake @@ -1,3 +1,5 @@ +SET(BEOS 1) + # GCC is the default compiler on BeOS. INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) diff --git a/Modules/Platform/CYGWIN.cmake b/Modules/Platform/CYGWIN.cmake index 89c3453..c9170a0 100644 --- a/Modules/Platform/CYGWIN.cmake +++ b/Modules/Platform/CYGWIN.cmake @@ -1,3 +1,6 @@ +SET(WIN32 1) +SET(CYGWIN 1) + SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,--export-all-symbols -Wl,--enable-auto-import") SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS ${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}) SET(CMAKE_DL_LIBS "-lgdi32" ) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 9aa36af..39a5412 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,3 +1,5 @@ +SET(APPLE 1) + SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") SET(CMAKE_SHARED_MODULE_PREFIX "lib") diff --git a/Modules/Platform/QNX.cmake b/Modules/Platform/QNX.cmake index 6c38af1..5c45ef4 100644 --- a/Modules/Platform/QNX.cmake +++ b/Modules/Platform/QNX.cmake @@ -1,3 +1,5 @@ +SET(QNXNTO 1) + # GCC is the default compiler on QNX 6.3. INCLUDE(${CMAKE_ROOT}/Modules/Platform/gcc.cmake) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index 5ff47f0..22c9a86 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -1,3 +1,5 @@ +SET(UNIX 1) + # also add the install directory of the running cmake to the search directories # CMAKE_ROOT is CMAKE_INSTALL_PREFIX/share/cmake, so we need to go two levels up GET_FILENAME_COMPONENT(_CMAKE_INSTALL_DIR "${CMAKE_ROOT}" PATH) diff --git a/Modules/Platform/Windows.cmake b/Modules/Platform/Windows.cmake index bf958d9..09cb8d3 100644 --- a/Modules/Platform/Windows.cmake +++ b/Modules/Platform/Windows.cmake @@ -1,3 +1,5 @@ +SET(WIN32 1) + SET(CMAKE_STATIC_LIBRARY_PREFIX "") SET(CMAKE_STATIC_LIBRARY_SUFFIX ".lib") SET(CMAKE_SHARED_LIBRARY_PREFIX "") # lib |