mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-05 14:49:39 -06:00
Revert commit502610733f(Ensure imported targets in sibling dirs are deduplicated, 2024-09-15, v3.31.0-rc1~92^2). Also revert the change from a copy of the logic made by commitcd418d4bb6(Static libraries de-duplication: keep first occurrence, 2024-09-29, v3.31.0-rc1~30^2). The logic was de-duplicating based on the target name rather than based on the library file path. Fixes: #26371 Issue: #26284
40 lines
1.3 KiB
CMake
40 lines
1.3 KiB
CMake
include(RunCMake)
|
|
|
|
# CMP0156 control how libraries are specified for the link step
|
|
# a sensible configuration is how circular dependency is handled
|
|
|
|
if(NOT RunCMake_GENERATOR_IS_MULTI_CONFIG)
|
|
set(OPTIONS -DCMAKE_BUILD_TYPE=Release)
|
|
endif()
|
|
|
|
macro(run_cmake_and_build test)
|
|
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/${test}-build)
|
|
set(RunCMake_TEST_OUTPUT_MERGE TRUE)
|
|
run_cmake_with_options(${test} ${OPTIONS})
|
|
set(RunCMake_TEST_NO_CLEAN TRUE)
|
|
run_cmake_command(${test}-build ${CMAKE_COMMAND} --build . --config Release)
|
|
unset(RunCMake_TEST_NO_CLEAN)
|
|
unset(RunCMake_TEST_BINARY_DIR)
|
|
unset(RunCMake_TEST_OUTPUT_MERGE)
|
|
endmacro()
|
|
|
|
run_cmake(CMP0156-WARN)
|
|
run_cmake_and_build(CMP0156-OLD)
|
|
run_cmake_and_build(CMP0156-NEW)
|
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
|
|
AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "15.0")
|
|
# special case for Apple: with CMP0156=OLD, linker will warning on duplicate libraries
|
|
run_cmake_and_build(CMP0156-OLD-AppleClang)
|
|
run_cmake_and_build(CMP0156-NEW-AppleClang)
|
|
endif()
|
|
|
|
|
|
run_cmake_and_build(CMP0156-NEW-Imported)
|
|
|
|
if (CMAKE_C_COMPILER_ID STREQUAL "AppleClang"
|
|
AND CMAKE_C_COMPILER_VERSION GREATER_EQUAL "15.0")
|
|
# special case for Apple: FIXME(#26284): linker will warning on duplicate libraries
|
|
run_cmake_and_build(CMP0156-NEW-AppleClang-Imported)
|
|
endif()
|