diff options
author | Brad King <brad.king@kitware.com> | 2024-02-21 21:00:42 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2024-02-21 22:08:57 (GMT) |
commit | 5b8e9e068fc634459cfaeed90e20072ebaa01710 (patch) | |
tree | 258da2cad84196a13eadb1298619cd2fd975375c /Tests/RunCMake/TargetObjects/Unity.cmake | |
parent | 1313c78a9caaa9f4ab1ed985b2132cf40f404e71 (diff) | |
download | CMake-5b8e9e068fc634459cfaeed90e20072ebaa01710.zip CMake-5b8e9e068fc634459cfaeed90e20072ebaa01710.tar.gz CMake-5b8e9e068fc634459cfaeed90e20072ebaa01710.tar.bz2 |
Restore support for TARGET_OBJECTS in link interfaces with unity builds
This was broken by commit df08c37a42 (cmGlobalGenerator: Add unity/pch
sources after computing compile features, 2024-02-02, v3.28.3~1^2~1^2),
and 3.28.2's commit 76b5383123 (cmGlobalGenerator: add unity sources
after computing target compile features, 2024-01-01, v3.28.2~17^2~1).
The problem is very similar to that fixed by commit 4e8f24e977 (PCH:
Clear link interface cache when adding PCH object to it, 2022-01-24,
v3.23.0-rc1~44^2~9). Generalize that fix.
Fixes: #25696
Diffstat (limited to 'Tests/RunCMake/TargetObjects/Unity.cmake')
-rw-r--r-- | Tests/RunCMake/TargetObjects/Unity.cmake | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/TargetObjects/Unity.cmake b/Tests/RunCMake/TargetObjects/Unity.cmake new file mode 100644 index 0000000..9c8e5c9 --- /dev/null +++ b/Tests/RunCMake/TargetObjects/Unity.cmake @@ -0,0 +1,13 @@ +enable_language(C) + +# Test transforming the set of object files provided by an object library. +set(CMAKE_UNITY_BUILD 1) + +add_library(UnityObj1 OBJECT UnityObj1.c) +add_library(UnityObj2 OBJECT UnityObj2.c) + +add_library(UnityObj2Iface INTERFACE) +target_link_libraries(UnityObj2Iface INTERFACE $<TARGET_OBJECTS:UnityObj2>) + +add_executable(UnityMain UnityMain.c) +target_link_libraries(UnityMain PRIVATE UnityObj1 UnityObj2Iface) |