diff options
Diffstat (limited to 'Tests/FindPackageModeMakefileTest/CMakeLists.txt')
-rw-r--r-- | Tests/FindPackageModeMakefileTest/CMakeLists.txt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/Tests/FindPackageModeMakefileTest/CMakeLists.txt b/Tests/FindPackageModeMakefileTest/CMakeLists.txt new file mode 100644 index 000000000..3674f0efe --- /dev/null +++ b/Tests/FindPackageModeMakefileTest/CMakeLists.txt @@ -0,0 +1,31 @@ + + +if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile") + + # Test whether the make is GNU make, and only add the test in this case, + # since the configured makefile in this test uses $(shell ...), which + # is AFAIK a GNU make extension. Alex + execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -v + OUTPUT_VARIABLE makeVersionOutput + ERROR_QUIET + TIMEOUT 10) + string(TOUPPER "${makeVersionOutput}" MAKE_VERSION_OUTPUT) + if("${MAKE_VERSION_OUTPUT}" MATCHES ".*GNU MAKE.*") + + # build a library which we can search during the test + add_library(foo STATIC foo.cpp) + + # 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) + + # now set up the test: + get_target_property(cmakeExecutable cmake LOCATION) + + 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) + + add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile ) + + endif() + +endif() |