2011-08-12 01:27:19 +04:00
|
|
|
|
|
|
|
|
2011-08-17 00:31:26 +04:00
|
|
|
if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile")
|
2011-08-12 01:27:19 +04:00
|
|
|
|
2011-08-18 01:44:34 +04:00
|
|
|
# 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
|
2011-10-13 00:20:18 +04:00
|
|
|
ERROR_QUIET
|
2011-08-18 01:44:34 +04:00
|
|
|
TIMEOUT 10)
|
|
|
|
string(TOUPPER "${makeVersionOutput}" MAKE_VERSION_OUTPUT)
|
|
|
|
if("${MAKE_VERSION_OUTPUT}" MATCHES ".*GNU MAKE.*")
|
2011-08-12 01:27:19 +04:00
|
|
|
|
2011-08-18 01:44:34 +04:00
|
|
|
# build a library which we can search during the test
|
|
|
|
add_library(foo STATIC foo.cpp)
|
2011-08-12 01:27:19 +04:00
|
|
|
|
2011-08-18 01:44:34 +04:00
|
|
|
# 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)
|
2011-08-12 01:27:19 +04:00
|
|
|
|
2011-08-18 01:44:34 +04:00
|
|
|
# now set up the test:
|
2013-06-28 18:37:39 +04:00
|
|
|
if (NOT CMAKE_VERSION VERSION_LESS 2.8.12)
|
|
|
|
file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk"
|
|
|
|
CONTENT "CMAKE = \"$<TARGET_FILE:cmake>\"\n"
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
get_target_property(cmakeLocation cmake LOCATION)
|
|
|
|
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cmakeExecutable.mk"
|
|
|
|
"CMAKE = \"${cmakeLocation}\"\n"
|
|
|
|
)
|
|
|
|
endif()
|
2011-08-18 01:44:34 +04:00
|
|
|
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()
|
2011-08-12 01:27:19 +04:00
|
|
|
|
|
|
|
endif()
|