summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Modules/Platform/Darwin-GNU-C.cmake2
-rw-r--r--Modules/Platform/Darwin-GNU-CXX.cmake2
-rw-r--r--Modules/Platform/Darwin-GNU.cmake18
-rw-r--r--Modules/Platform/Darwin.cmake14
-rw-r--r--Source/cmLocalGenerator.cxx9
7 files changed, 28 insertions, 21 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 209a33f..8428857 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -35,5 +35,7 @@ IF(CMAKE_C_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_C_COMPILER_ABI}")
ENDIF(CMAKE_C_COMPILER_ABI)
+SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@")
+
SET(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 0b5560e..0cd4618 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -36,5 +36,7 @@ IF(CMAKE_CXX_COMPILER_ABI)
SET(CMAKE_INTERNAL_PLATFORM_ABI "${CMAKE_CXX_COMPILER_ABI}")
ENDIF(CMAKE_CXX_COMPILER_ABI)
+SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@")
+
SET(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake
new file mode 100644
index 0000000..100e8b1
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU-C.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-GNU)
+cmake_gnu_has_isysroot(C)
diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake
new file mode 100644
index 0000000..a2c2e16
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU-CXX.cmake
@@ -0,0 +1,2 @@
+include(Platform/Darwin-GNU)
+cmake_gnu_has_isysroot(CXX)
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
new file mode 100644
index 0000000..8bbad88
--- /dev/null
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -0,0 +1,18 @@
+macro(cmake_gnu_has_isysroot lang)
+ if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x")
+ set(_doc "${lang} compiler has -isysroot")
+ message(STATUS "Checking whether ${_doc}")
+ execute_process(
+ COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help"
+ OUTPUT_VARIABLE _gcc_help
+ ERROR_VARIABLE _gcc_help
+ )
+ if("${_gcc_help}" MATCHES "isysroot")
+ message(STATUS "Checking whether ${_doc} - yes")
+ set(CMAKE_${lang}_HAS_ISYSROOT 1)
+ else()
+ message(STATUS "Checking whether ${_doc} - no")
+ set(CMAKE_${lang}_HAS_ISYSROOT 0)
+ endif()
+ endif()
+endmacro()
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index fff091f..825f218 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -182,20 +182,6 @@ IF(XCODE)
SET(CMAKE_INCLUDE_SYSTEM_FLAG_CXX)
ENDIF(XCODE)
-IF(NOT CMAKE_OSX_GCC_SUPPORT_ISYSROOT)
- IF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
- EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} "--version"
- OUTPUT_VARIABLE GCC_VERSION)
- ENDIF("${CMAKE_C_COMPILER_ID}" MATCHES "GNU")
- STRING(REGEX REPLACE "^[^ ]+[ ][^ ]+[ ]([^ ]+).*$" "\\1"
- gcc_version_tmp "${GCC_VERSION}")
- IF(${gcc_version_tmp} VERSION_GREATER 3.9)
- SET(CMAKE_OSX_GCC_SUPPORT_ISYSROOT TRUE CACHE INTERNAL "GCC supports isysroot")
- ELSE(${gcc_version_tmp} VERSION_GREATER 3.9)
- SET(CMAKE_OSX_GCC_SUPPORT_ISYSROOT FALSE CACHE INTERNAL "GCC supports isysroot")
- ENDIF(${gcc_version_tmp} VERSION_GREATER 3.9)
-ENDIF(NOT CMAKE_OSX_GCC_SUPPORT_ISYSROOT)
-
# Need to list dependent shared libraries on link line. When building
# with -isysroot (for universal binaries), the linker always looks for
# dependent libraries under the sysroot. Listing them on the link
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 800bb48..0ab4787 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1760,13 +1760,8 @@ void cmLocalGenerator::AddLanguageFlags(std::string& flags,
this->Makefile->GetDefinition("CMAKE_OSX_SYSROOT_DEFAULT");
const char* deploymentTarget =
this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET");
- const char* gccHasIsysroot =
- this->Makefile->GetRequiredDefinition("CMAKE_OSX_GCC_SUPPORT_ISYSROOT");
- bool hasIsysroot = true;
- if(cmSystemTools::IsOff(gccHasIsysroot))
- {
- hasIsysroot = false;
- }
+ std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT";
+ bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str());
bool flagsUsed = false;
if(osxArch && sysroot && lang && (lang[0] =='C' || lang[0] == 'F'))
{