From 1dc9716121ed3da5ffae3eb25031469620f275e8 Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Wed, 22 Oct 2008 02:56:07 +0000 Subject: [PATCH] CMake: `make install' for libraries, executables and header files. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57945 91177308-0d34-0410-b5e6-96231b3b80d8 --- CMakeLists.txt | 13 +++++++++++++ cmake/modules/AddLLVM.cmake | 7 +++++++ cmake/modules/AddPartiallyLinkedObject.cmake | 2 ++ tools/llvm-config/CMakeLists.txt | 5 +++++ 4 files changed, 27 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91ecf012875..837e8c1aaf8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,3 +157,16 @@ add_subdirectory(lib/Archive) add_subdirectory(tools) add_subdirectory(examples) + +install(DIRECTORY include + DESTINATION . + PATTERN ".svn" EXCLUDE + PATTERN "*.cmake" EXCLUDE + PATTERN "*.in" EXCLUDE + ) + +install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include + DESTINATION . + ) + +# TODO: make and install documentation. diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index d60b2885486..0b7d9c821a2 100755 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -7,6 +7,9 @@ macro(add_llvm_library name) if( LLVM_COMMON_DEPENDS ) add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) endif( LLVM_COMMON_DEPENDS ) + install(TARGETS ${name} + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) endmacro(add_llvm_library name) @@ -34,12 +37,16 @@ endmacro(add_llvm_executable name) macro(add_llvm_tool name) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR}) add_llvm_executable(${name} ${ARGN}) + install(TARGETS ${name} + RUNTIME DESTINATION bin) endmacro(add_llvm_tool name) macro(add_llvm_example name) # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR}) add_llvm_executable(${name} ${ARGN}) + install(TARGETS ${name} + RUNTIME DESTINATION examples) endmacro(add_llvm_example name) diff --git a/cmake/modules/AddPartiallyLinkedObject.cmake b/cmake/modules/AddPartiallyLinkedObject.cmake index 6968857db8d..4aba81f9c8f 100755 --- a/cmake/modules/AddPartiallyLinkedObject.cmake +++ b/cmake/modules/AddPartiallyLinkedObject.cmake @@ -32,4 +32,6 @@ macro(add_partially_linked_object lib) set( llvm_libs ${llvm_libs} ${pll} PARENT_SCOPE) set( llvm_lib_targets ${llvm_lib_targets} ${tnplo} PARENT_SCOPE ) endif( MSVC ) + install(FILES ${pll} + DESTINATION lib) endmacro(add_partially_linked_object lib) diff --git a/tools/llvm-config/CMakeLists.txt b/tools/llvm-config/CMakeLists.txt index 01167cb7996..0aac393b921 100644 --- a/tools/llvm-config/CMakeLists.txt +++ b/tools/llvm-config/CMakeLists.txt @@ -104,3 +104,8 @@ add_custom_target(llvm-config.target ALL DEPENDS ${LLVM_CONFIG}) add_dependencies(llvm-config.target ${llvm_lib_targets}) + +install(FILES ${LLVM_CONFIG} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE + WORLD_READ WORLD_EXECUTE + DESTINATION bin)