[PATCH] CMake: add LLVM_INSTALL_LIBRARIES variable
Hans Wennborg
hans at chromium.org
Fri Aug 16 11:26:21 PDT 2013
Hi rnk,
This variable controls whether the LLVM libraries and headers files should be part of the 'install' target. Excluding them is useful for creating a smaller installation package.
This also adds LLVM_INSTALL_TABLEGEN which can be used to exclude the tablegen binaries from the 'install' target for the same reason.
If this looks OK, I have patches to exclude Clang and lld libraries/headers in the same way.
http://llvm-reviews.chandlerc.com/D1428
Files:
CMakeLists.txt
cmake/modules/AddLLVM.cmake
cmake/modules/TableGen.cmake
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -229,6 +229,9 @@
"Build LLVM unit tests. If OFF, just generate build targets." OFF)
option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
+option(LLVM_INSTALL_LIBRARIES "Whether to install the LLVM libraries." ON)
+option(LLVM_INSTALL_TABLEGEN "Whether to install the TableGen utility." ON)
+
# All options referred to from HandleLLVMOptions have to be specified
# BEFORE this include, otherwise options will not be correctly set on
# first cmake run
@@ -465,28 +468,30 @@
add_subdirectory(cmake/modules)
-install(DIRECTORY include/
- DESTINATION include
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.td"
- PATTERN "*.inc"
- PATTERN "LICENSE.TXT"
- PATTERN ".svn" EXCLUDE
- )
+if ( LLVM_INSTALL_LIBRARIES )
+ install(DIRECTORY include/
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.td"
+ PATTERN "*.inc"
+ PATTERN "LICENSE.TXT"
+ PATTERN ".svn" EXCLUDE
+ )
-install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
- DESTINATION include
- FILES_MATCHING
- PATTERN "*.def"
- PATTERN "*.h"
- PATTERN "*.gen"
- PATTERN "*.inc"
- # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
- PATTERN "CMakeFiles" EXCLUDE
- PATTERN ".svn" EXCLUDE
- )
+ install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
+ DESTINATION include
+ FILES_MATCHING
+ PATTERN "*.def"
+ PATTERN "*.h"
+ PATTERN "*.gen"
+ PATTERN "*.inc"
+ # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
+ PATTERN "CMakeFiles" EXCLUDE
+ PATTERN ".svn" EXCLUDE
+ )
+endif()
# TODO: make and install documentation.
Index: cmake/modules/AddLLVM.cmake
===================================================================
--- cmake/modules/AddLLVM.cmake
+++ cmake/modules/AddLLVM.cmake
@@ -26,9 +26,11 @@
if( EXCLUDE_FROM_ALL )
set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
else()
- install(TARGETS ${name}
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ if ( LLVM_INSTALL_LIBRARIES )
+ install(TARGETS ${name}
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
+ endif()
endif()
set_target_properties(${name} PROPERTIES FOLDER "Libraries")
Index: cmake/modules/TableGen.cmake
===================================================================
--- cmake/modules/TableGen.cmake
+++ cmake/modules/TableGen.cmake
@@ -127,5 +127,7 @@
target_link_libraries(${target} pthread)
endif()
- install(TARGETS ${target} RUNTIME DESTINATION bin)
+ if ( LLVM_INSTALL_TABLEGEN )
+ install(TARGETS ${target} RUNTIME DESTINATION bin)
+ endif()
endmacro()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1428.1.patch
Type: text/x-patch
Size: 2924 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130816/a6c81bac/attachment.bin>
More information about the llvm-commits
mailing list