[PATCH] D70590: [Examples] Exclude ExampleIRTransforms from ALL if examples are disabled.
Florian Hahn via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 22 04:43:40 PST 2019
fhahn updated this revision to Diff 230634.
fhahn added a comment.
Update the patch to add a dedicated add_llvm_example_library macro, similar to add_llvm_example, which takes care of respecting LLVM_BUILD_EXAMPLES and setting the correct destinations.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D70590/new/
https://reviews.llvm.org/D70590
Files:
llvm/cmake/modules/AddLLVM.cmake
llvm/examples/IRTransforms/CMakeLists.txt
Index: llvm/examples/IRTransforms/CMakeLists.txt
===================================================================
--- llvm/examples/IRTransforms/CMakeLists.txt
+++ llvm/examples/IRTransforms/CMakeLists.txt
@@ -4,7 +4,7 @@
Support
)
-add_llvm_library(ExampleIRTransforms
+add_llvm_example_library(ExampleIRTransforms
InitializePasses.cpp
SimplifyCFG.cpp
Index: llvm/cmake/modules/AddLLVM.cmake
===================================================================
--- llvm/cmake/modules/AddLLVM.cmake
+++ llvm/cmake/modules/AddLLVM.cmake
@@ -983,6 +983,17 @@
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endmacro(add_llvm_example name)
+macro(add_llvm_example_library name)
+ if( NOT LLVM_BUILD_EXAMPLES )
+ set(EXCLUDE_FROM_ALL ON)
+ endif()
+ add_llvm_library (${name} ${ARGN})
+ if( LLVM_BUILD_EXAMPLES )
+ install(TARGETS ${name} RUNTIME DESTINATION examples)
+ endif()
+ set_target_properties(${name} PROPERTIES FOLDER "Examples")
+endmacro(add_llvm_example_library name)
+
# This is a macro that is used to create targets for executables that are needed
# for development, but that are not intended to be installed by default.
macro(add_llvm_utility name)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70590.230634.patch
Type: text/x-patch
Size: 1214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191122/b0bde21a/attachment.bin>
More information about the llvm-commits
mailing list