50 lines · plain
1# CMake policy settings shared between LLVM projects2 3# MSVC debug information format flags are selected via4# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of5# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.6# New in CMake 3.25.7#8# Supports debug info with SCCache9# (https://github.com/mozilla/sccache?tab=readme-ov-file#usage)10# avoiding “fatal error C1041: cannot open program database; if11# multiple CL.EXE write to the same .PDB file, please use /FS"12if(POLICY CMP0141)13 cmake_policy(SET CMP0141 NEW)14endif()15 16# CMP0144: find_package() uses uppercase <PackageName>_ROOT variables.17# New in CMake 3.27: https://cmake.org/cmake/help/latest/policy/CMP0144.html18if(POLICY CMP0144)19 cmake_policy(SET CMP0144 NEW)20endif()21 22# CMP0147: Visual Studio Generators build custom commands in parallel.23# New in CMake 3.27: https://cmake.org/cmake/help/latest/policy/CMP0147.html24if(POLICY CMP0147)25 cmake_policy(SET CMP0147 NEW)26endif()27 28# CMP0156: De-duplicate libraries on link lines based on linker capabilities.29# New in CMake 3.29: https://cmake.org/cmake/help/latest/policy/CMP0156.html30# Avoids the deluge of 'ld: warning: ignoring duplicate libraries' warnings when31# building with the Apple linker.32if(POLICY CMP0156)33 cmake_policy(SET CMP0156 NEW)34 35 # CMP0179: De-duplication of static libraries on link lines keeps first occurrence.36 # Dependent on CMP0156=NEW. Unifies the behaviour across platforms.37 # Works around a LLD bug ELF backend bug (#116669) and required for CMP015638 # to have an effect for affected versions. Also fixes building with CMake 3.31.0,39 # which lacked the workaround of ignoring CMP0156 unless this is enabled.40 if(POLICY CMP0179)41 cmake_policy(SET CMP0179 NEW)42 endif()43endif()44 45# CMP0182: Create shared library archives by default on AIX.46# New in CMake 4.0: https://cmake.org/cmake/help/latest/policy/CMP0182.html47if(POLICY CMP0182)48 cmake_policy(SET CMP0182 NEW)49endif()50