RunCMakeTest.cmake 1.35 KB
Newer Older
1
2
3
4
include(RunCMake)

run_cmake(invalid_name)
run_cmake(target_commands)
5
run_cmake(no_shared_libs)
6
run_cmake(invalid_signature)
7
run_cmake(global-interface)
8
run_cmake(genex_link)
9
run_cmake(add_custom_command-TARGET)
10
11
12
run_cmake(IMPORTED_LIBNAME-bad-value)
run_cmake(IMPORTED_LIBNAME-non-iface)
run_cmake(IMPORTED_LIBNAME-non-imported)
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36

function(run_WithSources CASE)
  if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
    set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
  endif()
  set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${CASE}-build)
  run_cmake(${CASE})
  set(RunCMake_TEST_NO_CLEAN 1)
  foreach(build IN LISTS ARGN)
    if(build MATCHES "^([^:]+)$")
      run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug)
    elseif(build MATCHES "^([^:]+):([^:,]+)(,merge)?$")
      if(CMAKE_MATCH_3 STREQUAL ",merge")
        set(RunCMake_TEST_OUTPUT_MERGE 1)
      endif()
      run_cmake_command(${CASE}-${CMAKE_MATCH_1} ${CMAKE_COMMAND} --build . --config Debug --target ${CMAKE_MATCH_2})
    endif()
  endforeach()
endfunction()

run_WithSources(ConfigSources "build1:iface")
run_WithSources(EmptySources "build1:iface" "build2:iface2,merge")
run_WithSources(ExcludeFromAll "build1" "build2:iface" "build3:iface2,merge")
run_WithSources(PublicSources "build1" "build2:iface" "build3:iface2,merge")
37
run_WithSources(IncludeDirectories "build1:iface")