mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-22 06:59:01 -06:00
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.
This commit is contained in:
@@ -14,3 +14,13 @@
|
||||
|
||||
find_program(CMAKE_MAKE_PROGRAM NAMES gmake make smake)
|
||||
mark_as_advanced(CMAKE_MAKE_PROGRAM)
|
||||
|
||||
# Look for a make tool provided by Xcode
|
||||
if(NOT CMAKE_MAKE_PROGRAM AND CMAKE_HOST_APPLE)
|
||||
execute_process(COMMAND xcrun --find make
|
||||
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
ERROR_VARIABLE _xcrun_err)
|
||||
if(_xcrun_out)
|
||||
set_property(CACHE CMAKE_MAKE_PROGRAM PROPERTY VALUE "${_xcrun_out}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user