[llvm] [CMake][Windows] Fix Debug config build when using MSBuild (PR #111765)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 9 14:48:20 PDT 2024


https://github.com/wjristow created https://github.com/llvm/llvm-project/pull/111765

Commit 95d4506dda caused a failure in a debug-build with MSBuild.  That commit conditionally makes an assignment to a cmake variable, but suppresses the assignment when LLVM_TABLEGEN is precicely "llvm-tblgen". This commit updates that change, so that the assignment is suppressed when LLVM_TABLEGEN logically is "llvm-tblgen" (i.e., it also suppresses it for "llvm-tblgen.exe", or for a full pathname that ends with llvm-tblgen" or "llvm-tblgen.exe").

>From 9666fa74570fb7a7ea8eeeccf2fc95f518b1e04b Mon Sep 17 00:00:00 2001
From: Warren Ristow <warren.ristow at sony.com>
Date: Wed, 9 Oct 2024 14:23:35 -0700
Subject: [PATCH] [CMake][Windows] Fix Debug config build when using MSBuild

Commit 95d4506dda caused a failure in a debug-build with MSBuild.  That
commit conditionally makes an assignment to a cmake variable, but
suppresses the assignment when LLVM_TABLEGEN is precicely "llvm-tblgen".
This commit updates that change, so that the assignment is suppressed
when LLVM_TABLEGEN logically is "llvm-tblgen" (i.e., it also suppresses
it for "llvm-tblgen.exe", or for a full pathname that ends with
llvm-tblgen" or "llvm-tblgen.exe").
---
 llvm/cmake/modules/TableGen.cmake | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/llvm/cmake/modules/TableGen.cmake b/llvm/cmake/modules/TableGen.cmake
index ffcc718b47775f..33608dfd098c10 100644
--- a/llvm/cmake/modules/TableGen.cmake
+++ b/llvm/cmake/modules/TableGen.cmake
@@ -191,9 +191,13 @@ macro(add_tablegen target project)
 
   # FIXME: Quick fix to reflect LLVM_TABLEGEN to llvm-min-tblgen
   if("${target}" STREQUAL "llvm-min-tblgen"
-      AND NOT "${LLVM_TABLEGEN}" STREQUAL ""
-      AND NOT "${LLVM_TABLEGEN}" STREQUAL "llvm-tblgen")
-    set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}")
+      AND NOT "${LLVM_TABLEGEN}" STREQUAL "")
+    # Extract base filename from full path.
+    get_filename_component(RAW_LLVM_TABLEGEN ${LLVM_TABLEGEN} NAME_WE)
+    if(NOT "${RAW_LLVM_TABLEGEN}" STREQUAL ""
+        AND NOT "${RAW_LLVM_TABLEGEN}" STREQUAL "llvm-tblgen")
+      set(${project}_TABLEGEN_DEFAULT "${LLVM_TABLEGEN}")
+    endif()
   endif()
 
   if(ADD_TABLEGEN_EXPORT)



More information about the llvm-commits mailing list