summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2012-09-21 08:53:42 -0400
committerBrad King <brad.king@kitware.com>2012-09-21 08:53:42 -0400
commita0a0877a1eb111d37ac4766a368206e73458489e (patch)
treedf5ed0dc179b7391972576c1c21ed70d87efbf22 /Modules
parent33a60e6bd148479c63734286417f582444bf36b6 (diff)
downloadcmake-a0a0877a1eb111d37ac4766a368206e73458489e.tar.gz
OS X: Always generate -isysroot if any SDK is in use
Drop the last use of CMAKE_OSX_SYSROOT_DEFAULT. Replace internal platform variable CMAKE_${lang}_HAS_ISYSROOT with a more general CMAKE_${lang}_SYSROOT_FLAG variable. If the -isysroot flag exists and CMAKE_OSX_SYSROOT points to an SDK (not "/") then always add it to compiler command lines. This is already done in the Xcode IDE.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/CMakeCCompiler.cmake.in2
-rw-r--r--Modules/CMakeCXXCompiler.cmake.in2
-rw-r--r--Modules/CMakeFindPackageMode.cmake4
-rw-r--r--Modules/Platform/Darwin-Clang.cmake2
-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.cmake9
7 files changed, 12 insertions, 11 deletions
diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in
index 17d63ebabf..d74dcdceec 100644
--- a/Modules/CMakeCCompiler.cmake.in
+++ b/Modules/CMakeCCompiler.cmake.in
@@ -45,7 +45,7 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@")
endif()
-set(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@")
+@CMAKE_C_SYSROOT_FLAG_CODE@
@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in
index 7f66be5061..8c5d84e6cb 100644
--- a/Modules/CMakeCXXCompiler.cmake.in
+++ b/Modules/CMakeCXXCompiler.cmake.in
@@ -46,7 +46,7 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE)
set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@")
endif()
-set(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@")
+@CMAKE_CXX_SYSROOT_FLAG_CODE@
@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@
set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake
index c9f58e3f32..cea0187069 100644
--- a/Modules/CMakeFindPackageMode.cmake
+++ b/Modules/CMakeFindPackageMode.cmake
@@ -53,8 +53,8 @@ include(CMakeDetermineSystem)
# short-cut some tests on Darwin, see Darwin-GNU.cmake:
if("${CMAKE_SYSTEM_NAME}" MATCHES Darwin AND "${COMPILER_ID}" MATCHES GNU)
- set(${CMAKE_${LANGUAGE}_HAS_ISYSROOT} 0 )
- set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "")
+ set(CMAKE_${LANGUAGE}_SYSROOT_FLAG "")
+ set(CMAKE_${LANGUAGE}_OSX_DEPLOYMENT_TARGET_FLAG "")
endif()
# Also load the system specific file, which sets up e.g. the search paths.
diff --git a/Modules/Platform/Darwin-Clang.cmake b/Modules/Platform/Darwin-Clang.cmake
index 46f06f7688..de7a85636d 100644
--- a/Modules/Platform/Darwin-Clang.cmake
+++ b/Modules/Platform/Darwin-Clang.cmake
@@ -21,6 +21,6 @@ set(__DARWIN_COMPILER_CLANG 1)
macro(__darwin_compiler_clang lang)
set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
+ set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=")
- set(CMAKE_${lang}_HAS_ISYSROOT 1)
endmacro()
diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake
index 4e326c4ca4..efdfd0014a 100644
--- a/Modules/Platform/Darwin-GNU-C.cmake
+++ b/Modules/Platform/Darwin-GNU-C.cmake
@@ -1,4 +1,4 @@
include(Platform/Darwin-GNU)
__darwin_compiler_gnu(C)
-cmake_gnu_has_isysroot(C)
+cmake_gnu_set_sysroot_flag(C)
cmake_gnu_set_osx_deployment_target_flag(C)
diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake
index b39487e585..e3c2ea7c57 100644
--- a/Modules/Platform/Darwin-GNU-CXX.cmake
+++ b/Modules/Platform/Darwin-GNU-CXX.cmake
@@ -1,4 +1,4 @@
include(Platform/Darwin-GNU)
__darwin_compiler_gnu(CXX)
-cmake_gnu_has_isysroot(CXX)
+cmake_gnu_set_sysroot_flag(CXX)
cmake_gnu_set_osx_deployment_target_flag(CXX)
diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake
index 5e9f8f0968..d9535039fc 100644
--- a/Modules/Platform/Darwin-GNU.cmake
+++ b/Modules/Platform/Darwin-GNU.cmake
@@ -24,8 +24,8 @@ macro(__darwin_compiler_gnu lang)
set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
endmacro()
-macro(cmake_gnu_has_isysroot lang)
- if("x${CMAKE_${lang}_HAS_ISYSROOT}" STREQUAL "x")
+macro(cmake_gnu_set_sysroot_flag lang)
+ if(NOT DEFINED CMAKE_${lang}_SYSROOT_FLAG)
set(_doc "${lang} compiler has -isysroot")
message(STATUS "Checking whether ${_doc}")
execute_process(
@@ -35,11 +35,12 @@ macro(cmake_gnu_has_isysroot lang)
)
if("${_gcc_help}" MATCHES "isysroot")
message(STATUS "Checking whether ${_doc} - yes")
- set(CMAKE_${lang}_HAS_ISYSROOT 1)
+ set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")
else()
message(STATUS "Checking whether ${_doc} - no")
- set(CMAKE_${lang}_HAS_ISYSROOT 0)
+ set(CMAKE_${lang}_SYSROOT_FLAG "")
endif()
+ set(CMAKE_${lang}_SYSROOT_FLAG_CODE "set(CMAKE_${lang}_SYSROOT_FLAG \"${CMAKE_${lang}_SYSROOT_FLAG}\")")
endif()
endmacro()