[PATCH] D54153: Fix compilation issue in VS2017 with Clang-tablegen and LLVM-tablegen

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 6 09:16:43 PST 2018


aganea updated this revision to Diff 172776.
aganea added a comment.

To give more insight: this part of script is called only if `LLVM_USE_HOST_TOOLS` is set, such as:

  if(CMAKE_CROSSCOMPILING OR (LLVM_OPTIMIZED_TABLEGEN AND (LLVM_ENABLE_ASSERTIONS OR CMAKE_CONFIGURATION_TYPES)))
    set(LLVM_USE_HOST_TOOLS ON)
  endif()

In my case, I've enabled `LLVM_OPTIMIZED_TABLEGEN` because it's faster to build. When using a "Visual Studio XX" generator `CMAKE_CONFIGURATION_TYPES` is also set. However, when using "Ninja", cmake is using `CMAKE_BUILD_TYPE` instead, and makes `CMAKE_CONFIGURATION_TYPES` an empty value.

Looking how multi-configuration are determined in cmake <https://gitlab.kitware.com/search?utf8=%E2%9C%93&search=IsGeneratorMultiConfig+&group_id=&project_id=541&search_code=true&repository_ref=master>, it looks like this issue would only affect Visual Studio and XCode generators.
I've constrained this patch to Visual Studio generators for now.


Repository:
  rL LLVM

https://reviews.llvm.org/D54153

Files:
  cmake/modules/TableGen.cmake


Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -165,6 +165,9 @@
         COMMENT "Building native TableGen..."
         USES_TERMINAL)
       add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE})
+      if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (NOT ${project} STREQUAL LLVM))
+        add_dependencies(${project}-tablegen-host LLVM-tablegen-host)
+      endif()
       set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE)
     endif()
   endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54153.172776.patch
Type: text/x-patch
Size: 623 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181106/a1c2e2fc/attachment.bin>


More information about the llvm-commits mailing list