summaryrefslogtreecommitdiffstats
path: root/Modules/CMakeDetermineCompiler.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-08-05 17:48:09 (GMT)
committerBrad King <brad.king@kitware.com>2013-08-06 13:00:18 (GMT)
commit03ab170fe0ad8fa44083dc2e2a6f662be480c9ff (patch)
treef7f8529ab1bcb9c208d0bced1e3554be6668ef30 /Modules/CMakeDetermineCompiler.cmake
parentbf5a5bc8b4788a236a53037c2f8a03904edf6079 (diff)
downloadCMake-03ab170fe0ad8fa44083dc2e2a6f662be480c9ff.zip
CMake-03ab170fe0ad8fa44083dc2e2a6f662be480c9ff.tar.gz
CMake-03ab170fe0ad8fa44083dc2e2a6f662be480c9ff.tar.bz2
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/CMakeDetermineCompiler.cmake')
-rw-r--r--Modules/CMakeDetermineCompiler.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/Modules/CMakeDetermineCompiler.cmake b/Modules/CMakeDetermineCompiler.cmake
index 2d12c07..f522c44 100644
--- a/Modules/CMakeDetermineCompiler.cmake
+++ b/Modules/CMakeDetermineCompiler.cmake
@@ -69,4 +69,17 @@ macro(_cmake_find_compiler lang)
endif()
unset(_${lang}_COMPILER_HINTS)
unset(_languages)
+
+ # Look for a make tool provided by Xcode
+ if(CMAKE_${lang}_COMPILER STREQUAL "CMAKE_${lang}_COMPILER-NOTFOUND" AND CMAKE_HOST_APPLE)
+ foreach(comp ${CMAKE_${lang}_COMPILER_LIST})
+ execute_process(COMMAND xcrun --find ${comp}
+ OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
+ ERROR_VARIABLE _xcrun_err)
+ if(_xcrun_out)
+ set_property(CACHE CMAKE_${lang}_COMPILER PROPERTY VALUE "${_xcrun_out}")
+ break()
+ endif()
+ endforeach()
+ endif()
endmacro()