Files
CMake/Tests/RunCMake/ExportImport/RunCMakeTest.cmake
Brad King 0ebff0d61a export: Restore exclusion of private shared library dependencies from checks
Refactoring in commit 8c65b7042e (cmExportFileGenerator: Simplify
collection of targets missing from export set, 2022-04-11,
v3.24.0-rc1~281^2) accidentally dropped the behavior change from
commit 0ad2a1c181 (Export: Never treat private link libraries as
public package dependencies., 2013-09-24, v3.0.0-rc1~559^2).
Restore the behavior and add a test.

Fixes: #23838
2022-08-15 10:40:03 -04:00

25 lines
974 B
CMake

cmake_minimum_required(VERSION 3.23)
include(RunCMake)
function(run_ExportImport_test case)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-export-build)
set(CMAKE_INSTALL_PREFIX ${RunCMake_TEST_BINARY_DIR}/root)
if (NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
endif()
run_cmake(${case}-export)
unset(RunCMake_TEST_OPTIONS)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(${case}-export-build ${CMAKE_COMMAND} --build . --config Debug)
run_cmake_command(${case}-export-install ${CMAKE_COMMAND} -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DBUILD_TYPE=Debug -P cmake_install.cmake)
unset(RunCMake_TEST_NO_CLEAN)
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${case}-import-build)
run_cmake_with_options(${case}-import
-Dfoo_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/foo
-Dbar_DIR=${CMAKE_INSTALL_PREFIX}/lib/cmake/bar
)
endfunction()
run_ExportImport_test(SharedDep)