[llvm] [CMake] Enable CMP0179 when enabling CMP0156 to avoid LLD static library link order bug (PR #116497)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 17:05:23 PST 2024
================
@@ -37,4 +37,13 @@ endif()
# building with the Apple linker.
if(POLICY CMP0156)
cmake_policy(SET CMP0156 NEW)
+
+ # CMP0179: De-duplication of static libraries on link lines keeps first occurrence.
+ # Dependent on CMP0156=NEW. Keeps the first occurrence of static libraries
+ # during deduplication to unify the behaviour on all platforms.
+ # Also works around LLD bug exhibited since CMake 3.31.0 with an expected
+ # workaround in 3.31.1 (https://gitlab.kitware.com/cmake/cmake/-/issues/26447).
+ if(POLICY CMP0179)
+ cmake_policy(SET CMP0179 NEW)
+ endif()
----------------
boomanaiden154 wrote:
These CMake targets will eventually be set to new (unless explicitly set to old) once we bump the minimum required CMake version. It would be nice if when we run across issues we set the policy to make it easier when bumping the CMake version.
Agreed that this is not really the correct solution to the specific problem mentioned here though.
https://github.com/llvm/llvm-project/pull/116497
More information about the llvm-commits
mailing list