aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/AddLLVM.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/AddLLVM.cmake')
-rwxr-xr-xcmake/modules/AddLLVM.cmake23
1 files changed, 18 insertions, 5 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index c0ce897f4f1a..0ecd153c6be4 100755
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -46,7 +46,12 @@ endmacro(add_llvm_loadable_module name)
macro(add_llvm_executable name)
llvm_process_sources( ALL_FILES ${ARGN} )
- add_executable(${name} ${ALL_FILES})
+ if( EXCLUDE_FROM_ALL )
+ add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
+ else()
+ add_executable(${name} ${ALL_FILES})
+ endif()
+ set(EXCLUDE_FROM_ALL OFF)
if( LLVM_USED_LIBS )
foreach(lib ${LLVM_USED_LIBS})
target_link_libraries( ${name} ${lib} )
@@ -67,17 +72,25 @@ endmacro(add_llvm_executable name)
macro(add_llvm_tool name)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
+ if( NOT LLVM_BUILD_TOOLS )
+ set(EXCLUDE_FROM_ALL ON)
+ endif()
add_llvm_executable(${name} ${ARGN})
- install(TARGETS ${name}
- RUNTIME DESTINATION bin)
+ if( LLVM_BUILD_TOOLS )
+ install(TARGETS ${name} RUNTIME DESTINATION bin)
+ endif()
endmacro(add_llvm_tool name)
macro(add_llvm_example name)
# set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
+ if( NOT LLVM_BUILD_EXAMPLES )
+ set(EXCLUDE_FROM_ALL ON)
+ endif()
add_llvm_executable(${name} ${ARGN})
- install(TARGETS ${name}
- RUNTIME DESTINATION examples)
+ if( LLVM_BUILD_EXAMPLES )
+ install(TARGETS ${name} RUNTIME DESTINATION examples)
+ endif()
endmacro(add_llvm_example name)