diff options
Diffstat (limited to 'Tests/FindPackageModeMakefileTest/CMakeLists.txt')
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt index d2c6be9..17f02b4 100644 --- a/Tests/FindPackageModeMakefileTest/CMakeLists.txt +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -1,22 +1,20 @@ -if("${CMAKE_CXX_COMPILER_ID}" MATCHES GNU - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Intel - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES Clang - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES XL - OR "${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro) - find_package(PNG) +# the test program links against the png lib, so test first whether it exists +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") - # the test program links against the png lib, so test first whether it exists - if(PNG_FOUND AND UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") + # build a library which we can search during the test + add_library(foo STATIC foo.cpp) - get_target_property(cmakeExecutable cmake LOCATION) + # 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) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY) + # now set up the test: + get_target_property(cmakeExecutable cmake LOCATION) - add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile ) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY) - endif() + add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile ) endif() |