summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeDetermineSystem.cmake13
-rw-r--r--Modules/CMakeSystemSpecificInformation.cmake10
-rw-r--r--Source/cmMakefile.cxx15
3 files changed, 20 insertions, 18 deletions
diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake
index 7e6a6dd..c7db715 100644
--- a/Modules/CMakeDetermineSystem.cmake
+++ b/Modules/CMakeDetermineSystem.cmake
@@ -60,19 +60,6 @@ ELSE(CMAKE_HOST_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_*
# variables around so they can be used in CMakeLists.txt.
diff --git a/Modules/CMakeSystemSpecificInformation.cmake b/Modules/CMakeSystemSpecificInformation.cmake
index c0af01a..561f5e3 100644
--- a/Modules/CMakeSystemSpecificInformation.cmake
+++ b/Modules/CMakeSystemSpecificInformation.cmake
@@ -3,11 +3,11 @@
# 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.
+# before cmake 2.6 these variables were set in cmMakefile.cxx. This is still
+# done to keep scripts and custom language and compiler modules working.
+# But they are reset here and set again in the platform files for the target
+# platform, so they can be used for testing the target platform instead
+# of testing the host platform.
SET(APPLE )
SET(UNIX )
SET(CYGWIN )
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index a6dd2e1..ecfdf80 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1911,16 +1911,31 @@ void cmMakefile::RemoveVariablesInString(std::string& source,
*/
void cmMakefile::AddDefaultDefinitions()
{
+/* Up to CMake 2.4 here only WIN32, UNIX and APPLE were set.
+ With CMake must separate between target and host platform. In most cases
+ the tests for WIN32, UNIX and APPLE will be for the target system, so an
+ additional set of variables for the host system is required ->
+ CMAKE_HOST_WIN32, CMAKE_HOST_UNIX, CMAKE_HOST_APPLE.
+ WIN32, UNIX and APPLE are now set in the platform files in
+ Modules/Platforms/.
+ To keep cmake scripts (-P) and custom language and compiler modules
+ working, these variables are still also set here in this place, but they
+ will be reset in CMakeSystemSpecificInformation.cmake before the platform
+ files are executed. */
#if defined(_WIN32) || defined(__CYGWIN__)
+ this->AddDefinition("WIN32", "1");
this->AddDefinition("CMAKE_HOST_WIN32", "1");
#else
+ this->AddDefinition("UNIX", "1");
this->AddDefinition("CMAKE_HOST_UNIX", "1");
#endif
// Cygwin is more like unix so enable the unix commands
#if defined(__CYGWIN__)
+ this->AddDefinition("UNIX", "1");
this->AddDefinition("CMAKE_HOST_UNIX", "1");
#endif
#if defined(__APPLE__)
+ this->AddDefinition("APPLE", "1");
this->AddDefinition("CMAKE_HOST_APPLE", "1");
#endif