RunCMakeTest.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. include(RunCMake)
  2. run_cmake(invalid_name)
  3. run_cmake(target_commands)
  4. run_cmake(no_shared_libs)
  5. run_cmake(invalid_signature)
  6. run_cmake(global-interface)
  7. run_cmake(genex_link)
  8. run_cmake(add_custom_command-TARGET)
  9. run_cmake(IMPORTED_LIBNAME-bad-value)
  10. run_cmake(IMPORTED_LIBNAME-non-iface)
  11. run_cmake(IMPORTED_LIBNAME-non-imported)
  12. function(run_WithSources CASE)
  13. if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
  14. set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
  15. endif()
  16. set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
  17. run_cmake(${CASE})
  18. set(RunCMake_TEST_NO_CLEAN 1)
  19. foreach(build IN LISTS ARGN)
  20. if(build MATCHES "^([^:]+)$")
  21. run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug)
  22. elseif(build MATCHES "^([^:]+):([^:,]+)(,merge)?$")
  23. if(CMAKE_MATCH_3 STREQUAL ",merge")
  24. set(RunCMake_TEST_OUTPUT_MERGE 1)
  25. endif()
  26. run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug --target ${CMAKE_MATCH_2})
  27. endif()
  28. endforeach()
  29. endfunction()
  30. run_WithSources(ConfigSources "build1:iface")
  31. run_WithSources(EmptySources "build1:iface" "build2:iface2,merge")
  32. run_WithSources(ExcludeFromAll "build1" "build2:iface" "build3:iface2,merge")
  33. run_WithSources(PublicSources "build1" "build2:iface" "build3:iface2,merge")