Files
CMake/Tests/RunCMake/InterfaceLibrary/RunCMakeTest.cmake
Brad King 53aabe9817 VS: Fix assertion failure on INCLUDE_DIRECTORIES in INTERFACE libraries
Since commit 4391913133 (Add INTERFACE libraries to generated
buildsystem if they have SOURCES, 2020-07-20, v3.19.0-rc1~346^2~1), the
VS generator may process INTERFACE libraries.  Avoid code paths in the
generator that process include directories because they should not be
used by INTERFACE libraries since they do not compile anything.

Fixes: #22494
2021-07-29 11:38:58 -04:00

38 lines
1.4 KiB
CMake

include(RunCMake)
run_cmake(invalid_name)
run_cmake(target_commands)
run_cmake(no_shared_libs)
run_cmake(invalid_signature)
run_cmake(global-interface)
run_cmake(genex_link)
run_cmake(add_custom_command-TARGET)
run_cmake(IMPORTED_LIBNAME-bad-value)
run_cmake(IMPORTED_LIBNAME-non-iface)
run_cmake(IMPORTED_LIBNAME-non-imported)
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")
run_WithSources(IncludeDirectories "build1:iface")