diff options
author | Craig Scott <craig.scott@crascit.com> | 2019-10-27 21:25:18 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2019-10-28 20:14:08 (GMT) |
commit | c37f4eff5e299212544089f692dc8b090992d7b8 (patch) | |
tree | e85ac52452dfc9925b6c8817927bf30253039a66 /Tests | |
parent | 92eb3a4475e92d993b901c06d967210912390ada (diff) | |
download | CMake-c37f4eff5e299212544089f692dc8b090992d7b8.zip CMake-c37f4eff5e299212544089f692dc8b090992d7b8.tar.gz CMake-c37f4eff5e299212544089f692dc8b090992d7b8.tar.bz2 |
FindPackageModeMakefileTest: macOS needs isysroot flag
macOS/Xcode no longer populate /usr/include.
Building with the compiler directly instead of using /usr/bin/c++
can result in missing headers without the -isysroot flag.
Relates: #19885
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 8 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/Makefile.in | 3 |
2 files changed, 10 insertions, 1 deletions
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 23832da..8a87a8c 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -19,6 +19,14 @@ if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile" AND # configure a FindFoo.cmake so it knows where the library can be found configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY) + # Need the -isysroot flag on recentish macOS after command line tools + # no longer provide headers in /usr/include + if(APPLE AND CMAKE_OSX_SYSROOT) + set(__EXTRA_OSX_SYSROOT_FLAGS "-isysroot ${CMAKE_OSX_SYSROOT}") + else() + set(__EXTRA_OSX_SYSROOT_FLAGS "") + endif() + # now set up the test: file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk" CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n" diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index 8e7ff72..5ef67d0 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -5,6 +5,7 @@ CMAKE_CURRENT_BINARY_DIR = "@CMAKE_CURRENT_BINARY_DIR@" CMAKE_CXX_COMPILER = "@CMAKE_CXX_COMPILER@" CMAKE_CXX_COMPILER_ID = "@CMAKE_CXX_COMPILER_ID@" CMAKE_CXX_FLAGS = @CMAKE_CXX_FLAGS@ +__EXTRA_OSX_SYSROOT_FLAGS = @__EXTRA_OSX_SYSROOT_FLAGS@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_DIR) -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=$(CMAKE_CXX_COMPILER_ID) @@ -15,7 +16,7 @@ all: pngtest main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(__EXTRA_OSX_SYSROOT_FLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) |