[llvm] [CMake] Enable new policy for CMAKE_MSVC_DEBUG_INFORMATION_FORMAT (PR #82371)
Dave Abrahams via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 6 15:03:19 PST 2024
https://github.com/dabrahams updated https://github.com/llvm/llvm-project/pull/82371
>From 9e206c0704a3fb997648ca189876cdfe1c1ec8d7 Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dabrahams at adobe.com>
Date: Tue, 20 Feb 2024 07:26:29 -0800
Subject: [PATCH 1/4] Enable the use of SCCache for debug builds on Windows
---
cmake/Modules/CMakePolicy.cmake | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index 0ec32ad8637f3d..bdbb836e56e8ed 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -10,3 +10,9 @@ endif()
if(POLICY CMP0116)
cmake_policy(SET CMP0116 OLD)
endif()
+
++# Enable debug info compatible with SCCache
++# https://github.com/mozilla/sccache?tab=readme-ov-file#usage
++if(POLICY CMP0141)
++ cmake_policy(SET CMP0141 NEW)
++endif()
>From 3b79ff0e03b25a4cf563f3b9a53e9d5fee4eebed Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dabrahams at adobe.com>
Date: Tue, 20 Feb 2024 09:43:29 -0800
Subject: [PATCH 2/4] Update comment
---
cmake/Modules/CMakePolicy.cmake | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index bdbb836e56e8ed..3ef9797aebe334 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -12,7 +12,13 @@ if(POLICY CMP0116)
endif()
+# Enable debug info compatible with SCCache
-+# https://github.com/mozilla/sccache?tab=readme-ov-file#usage
+# MSVC debug information format flags are selected by an
+# abstraction. New in CMake 3.25.
+#
+# Supports debug info with SCCache
+# (https://github.com/mozilla/sccache?tab=readme-ov-file#usage)
+# avoiding “fatal error C1041: cannot open program database; if
+# multiple CL.EXE write to the same .PDB file, please use /FS"
+if(POLICY CMP0141)
+ cmake_policy(SET CMP0141 NEW)
+endif()
>From f397bfccefca16f264489cb88baec625e55a77ce Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dabrahams at adobe.com>
Date: Thu, 22 Feb 2024 09:07:58 -0800
Subject: [PATCH 3/4] Take wording suggestion.
---
cmake/Modules/CMakePolicy.cmake | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index 3ef9797aebe334..62ec233a39a9a8 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -12,8 +12,10 @@ if(POLICY CMP0116)
endif()
+# Enable debug info compatible with SCCache
-# MSVC debug information format flags are selected by an
-# abstraction. New in CMake 3.25.
+# MSVC debug information format flags are selected via
+# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
+# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
+# New in CMake 3.25.
#
# Supports debug info with SCCache
# (https://github.com/mozilla/sccache?tab=readme-ov-file#usage)
>From 4e9f5caf11f26c014a5c66d5ee00c6564cfc62ac Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dabrahams at adobe.com>
Date: Wed, 6 Mar 2024 15:03:12 -0800
Subject: [PATCH 4/4] Take review request
---
cmake/Modules/CMakePolicy.cmake | 1 -
1 file changed, 1 deletion(-)
diff --git a/cmake/Modules/CMakePolicy.cmake b/cmake/Modules/CMakePolicy.cmake
index 62ec233a39a9a8..b5bd1e6cdffe18 100644
--- a/cmake/Modules/CMakePolicy.cmake
+++ b/cmake/Modules/CMakePolicy.cmake
@@ -11,7 +11,6 @@ if(POLICY CMP0116)
cmake_policy(SET CMP0116 OLD)
endif()
-+# Enable debug info compatible with SCCache
# MSVC debug information format flags are selected via
# CMAKE_MSVC_DEBUG_INFORMATION_FORMAT, instead of
# embedding flags in e.g. CMAKE_CXX_FLAGS_RELEASE.
More information about the llvm-commits
mailing list