diff options
author | Brad King <brad.king@kitware.com> | 2021-03-03 18:24:51 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-03-03 18:29:35 (GMT) |
commit | 42edf53ce2b201ca022d1f8170bb4323226c468a (patch) | |
tree | 3707784649ca9a096f2c8004164ad85ae2239811 /Tests | |
parent | 2f3a3eb01f171810ae77c1a6a2647c47a1edb63d (diff) | |
download | CMake-42edf53ce2b201ca022d1f8170bb4323226c468a.zip CMake-42edf53ce2b201ca022d1f8170bb4323226c468a.tar.gz CMake-42edf53ce2b201ca022d1f8170bb4323226c468a.tar.bz2 |
Tests: Generalize FindPackageModeMakefileTest extra flags var
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 13 | ||||
-rw-r--r-- | Tests/FindPackageModeMakefileTest/Makefile.in | 6 |
2 files changed, 10 insertions, 9 deletions
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index 8a87a8c..909ba30 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -19,12 +19,13 @@ 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 "") + set(EXTRA_FLAGS "") + if(APPLE) + # Need the -isysroot flag on recentish macOS after command line tools + # no longer provide headers in /usr/include + if(CMAKE_OSX_SYSROOT) + string(APPEND EXTRA_FLAGS " -isysroot ${CMAKE_OSX_SYSROOT}") + endif() endif() # now set up the test: diff --git a/Tests/FindPackageModeMakefileTest/Makefile.in b/Tests/FindPackageModeMakefileTest/Makefile.in index af9fa96..695c64f 100644 --- a/Tests/FindPackageModeMakefileTest/Makefile.in +++ b/Tests/FindPackageModeMakefileTest/Makefile.in @@ -5,7 +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@ +EXTRA_FLAGS = @EXTRA_FLAGS@ CMAKE_FOO = $(CMAKE) --find-package -DCMAKE_MODULE_PATH=$(CMAKE_CURRENT_BINARY_DIR) -DNAME=Foo -DLANGUAGE=CXX -DCOMPILER_ID=$(CMAKE_CXX_COMPILER_ID) @@ -16,7 +16,7 @@ all: pngtest main.o: clean main.cpp @$(CMAKE_FOO) -DMODE=COMPILE >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(__EXTRA_OSX_SYSROOT_FLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s %s -c main.cpp\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(EXTRA_FLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) @@ -24,7 +24,7 @@ main.o: clean main.cpp pngtest: main.o @$(CMAKE_FOO) -DMODE=LINK >$(tmp) @foo="`cat $(tmp)`"; \ - printf '"%s" %s %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(__EXTRA_OSX_SYSROOT_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) + printf '"%s" %s %s %s -o pngtest main.o %s\n' $(CMAKE_CXX_COMPILER) "$(CMAKE_CXX_FLAGS)" "$(EXTRA_FLAGS)" "$(LDFLAGS)" "$$foo" >$(tmp) @cat $(tmp) @sh $(tmp) @rm -f $(tmp) |