summaryrefslogtreecommitdiff
path: root/Modules/Platform
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-08-05 13:48:09 -0400
committerBrad King <brad.king@kitware.com>2013-08-06 09:00:18 -0400
commit03ab170fe0ad8fa44083dc2e2a6f662be480c9ff (patch)
treef7f8529ab1bcb9c208d0bced1e3554be6668ef30 /Modules/Platform
parentbf5a5bc8b4788a236a53037c2f8a03904edf6079 (diff)
downloadcmake-03ab170fe0ad8fa44083dc2e2a6f662be480c9ff.tar.gz
OS X: Enable command-line build without tools in PATH
Teach modules CMakeDetermineCompiler and CMakeUnixFindMake to ask Xcode where to find the compiler or make tools, using 'xcrun --find', if none is found in the PATH. Teach module Platform/Darwin to add the path to the SDK to CMAKE_SYSTEM_PREFIX_PATH so that find_* command look there. Also add the SDK /usr/include directory to the implicit include list in CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES to suppress explicit -I options for it.
Diffstat (limited to 'Modules/Platform')
-rw-r--r--Modules/Platform/Darwin.cmake6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake
index 865cc8e6de..db8c7ef8b2 100644
--- a/Modules/Platform/Darwin.cmake
+++ b/Modules/Platform/Darwin.cmake
@@ -326,6 +326,12 @@ set(CMAKE_SYSTEM_APPBUNDLE_PATH
unset(_apps_paths)
include(Platform/UnixPaths)
+if(_CMAKE_OSX_SYSROOT_PATH AND EXISTS ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ list(APPEND CMAKE_SYSTEM_PREFIX_PATH ${_CMAKE_OSX_SYSROOT_PATH}/usr)
+ foreach(lang C CXX)
+ list(APPEND CMAKE_${lang}_IMPLICIT_INCLUDE_DIRECTORIES ${_CMAKE_OSX_SYSROOT_PATH}/usr/include)
+ endforeach()
+endif()
list(APPEND CMAKE_SYSTEM_PREFIX_PATH
/sw # Fink
/opt/local # MacPorts