[PATCH] D41580: CMAKE: Add flags to skip building NATIVE tools
Don Hinton via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 26 07:31:36 PST 2017
hintonda added a comment.
I like your idea, but can't you do this without adding new flags?
You already have to pass `-D(CLANG|LLVM)_TABLEGEN` which prevents them from getting built. llvm-config is a little different in that you need to pass `-D_LLVM_CONFIG_EXE` since `project` is undefined in tools/llvm-config, but adding a test for `${project}_LLVM_CONFIG_EXE` is consistent and should work as well. Perhaps this needs to be refactored as well, so you can pass `-DLLVM_CONFIG_EXE` instead of `-D_LLVM_CONFIG_EXE`.
It might also be nice to add a test for all three before setting `LLVM_USE_HOST_TOOLS` which will prevent configuring NATIVE tools altogether if not needed.
================
Comment at: cmake/modules/TableGen.cmake:150
+ if(LLVM_USE_HOST_TOOLS AND NOT HAVE_NATIVE_${project}_TABLEGEN)
if( ${${project}_TABLEGEN} STREQUAL "${target}" )
if (NOT CMAKE_CONFIGURATION_TYPES)
----------------
This line already tests whether or not to build a new NATIVE tblgen, so I don't think you need to change this file. Passing -D(CLANG|LLVM)_TABLEGEN should just work here -- or explicitly adding it to the cache in your toolchain file.
================
Comment at: tools/llvm-config/CMakeLists.txt:67
-if(CMAKE_CROSSCOMPILING)
+if(CMAKE_CROSSCOMPILING AND NOT HAVE_NATIVE_LLVM_CONFIG)
set(${project}_LLVM_CONFIG_EXE "${LLVM_NATIVE_BUILD}/bin/llvm-config")
----------------
Instead of a new flag, can't you just add `AND NOT DEFINED ${project}_LLVM_CONFIG_EXE`?
Repository:
rL LLVM
https://reviews.llvm.org/D41580
More information about the llvm-commits
mailing list