1
0

CMakeLists.txt 1.1 KB

123456789101112131415161718192021222324252627282930
  1. if(UNIX AND "${CMAKE_GENERATOR}" MATCHES "Makefile")
  2. # Test whether the make is GNU make, and only add the test in this case,
  3. # since the configured makefile in this test uses $(shell ...), which
  4. # is AFAIK a GNU make extension. Alex
  5. execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} -v
  6. OUTPUT_VARIABLE makeVersionOutput
  7. TIMEOUT 10)
  8. string(TOUPPER "${makeVersionOutput}" MAKE_VERSION_OUTPUT)
  9. if("${MAKE_VERSION_OUTPUT}" MATCHES ".*GNU MAKE.*")
  10. # build a library which we can search during the test
  11. add_library(foo STATIC foo.cpp)
  12. # configure a FindFoo.cmake so it knows where the library can be found
  13. configure_file(FindFoo.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FindFoo.cmake @ONLY)
  14. # now set up the test:
  15. get_target_property(cmakeExecutable cmake LOCATION)
  16. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Makefile.in ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile @ONLY)
  17. configure_file(${CMAKE_CURRENT_SOURCE_DIR}/main.cpp ${CMAKE_CURRENT_BINARY_DIR}/main.cpp COPYONLY)
  18. add_test(FindPackageModeMakefileTest ${CMAKE_MAKE_PROGRAM} -f ${CMAKE_CURRENT_BINARY_DIR}/ConfMakefile )
  19. endif()
  20. endif()