[libcxx-commits] [libcxx] [libc++] Fix how we pass /MANIFEST flag on Windows without clang-cl (PR #96967)

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 27 14:00:18 PDT 2024


https://github.com/ldionne created https://github.com/llvm/llvm-project/pull/96967

If we're compiling with Clang (not clang-cl) on Windows, we need to use -Xlinker to pass the /MANIFEST option.

Fixes #96430

>From 71f34e58c2c004b42ad58e8411de56c6dbb5414a Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 27 Jun 2024 15:58:31 -0500
Subject: [PATCH] [libc++] Fix how we pass /MANIFEST flag on Windows without
 clang-cl

If we're compiling with Clang (not clang-cl) on Windows, we need
to use -Xlinker to pass the /MANIFEST option.

Fixes #96430
---
 libcxx/src/CMakeLists.txt | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libcxx/src/CMakeLists.txt b/libcxx/src/CMakeLists.txt
index 9e6c70335a794..8ba6f00bf9dad 100644
--- a/libcxx/src/CMakeLists.txt
+++ b/libcxx/src/CMakeLists.txt
@@ -275,8 +275,13 @@ if (LIBCXX_ENABLE_SHARED)
     # Since we most likely do not have a mt.exe replacement, disable the
     # manifest bundling.  This allows a normal cmake invocation to pass which
     # will attempt to use the manifest tool to generate the bundled manifest
-    set_target_properties(cxx_shared PROPERTIES
-                          APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
+    if (${CMAKE_CXX_COMPILER_FRONTEND_VARIANT} STREQUAL "MSVC")
+      set_target_properties(cxx_shared PROPERTIES
+                            APPEND_STRING PROPERTY LINK_FLAGS " /MANIFEST:NO")
+    else()
+      set_target_properties(cxx_shared PROPERTIES
+                            APPEND_STRING PROPERTY LINK_FLAGS " -Xlinker /MANIFEST:NO")
+    endif()
   endif()
 endif()
 



More information about the libcxx-commits mailing list