Skip to content

Commit 437b33e

Browse files
committed
Enable CMP0156 on LLVM
CMP0156 removes duplicate library links based on linker capabilities. The new Apple linker emits warnings when libraries are repeated on the link line because they do not have an effect. Enabling this policy will remove the duplicate libraries, fixing these warnings.
1 parent 0ffc76a commit 437b33e

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

cmake/Modules/CMakePolicy.cmake

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ endif()
2929
if(POLICY CMP0144)
3030
cmake_policy(SET CMP0144 NEW)
3131
endif()
32+
33+
# CMP0156: De-duplicate libraries on link lines based on linker capabilities.
34+
# New in CMake 3.29: https://cmake.org/cmake/help/latest/policy/CMP0156.html
35+
# Avoids the deluge of 'ld: warning: ignoring duplicate libraries' warnings when
36+
# building with the Apple linker.
37+
if(POLICY CMP0156)
38+
cmake_policy(SET CMP0156 NEW)
39+
endif()

0 commit comments

Comments
 (0)