summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2015-04-16 16:56:18 +0000
committerChris Bieneman <beanz@apple.com>2015-04-16 16:56:18 +0000
commit1a0e0ea4fbf3838d9eb08aa10f43e94e1b0f0649 (patch)
tree071b6ddc7ceba21353b72e3cfd96df4b7ba61f26 /cmake
parentafc67405f8d3a755650a1cb4bb62ea76e21ed5fb (diff)
Fixing a mis-use of the CMake install command.
The CMake install command is defined as: install(TARGETS targets... [EXPORT <export-name>] [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE| PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE] [DESTINATION <dir>] [INCLUDES DESTINATION [<dir> ...]] [PERMISSIONS permissions...] [CONFIGURATIONS [Debug|Release|...]] [COMPONENT <component>] [OPTIONAL] [NAMELINK_ONLY|NAMELINK_SKIP] ] [...]) This means it can only take one parameter from the set of RUNTIME, LIBRARY, or ARCHIVE. If you set more than one of these it seems to gobble up the extra arguments and ignore the COMPONENT argument. This adds a check to only set LIBRARY or ARCHIVE based on whether or not the library being built is shared. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235113 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'cmake')
-rw-r--r--cmake/modules/AddLLVM.cmake22
1 files changed, 16 insertions, 6 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 98db042d56..18a97235b8 100644
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -407,6 +407,11 @@ function(llvm_add_library name)
endfunction()
macro(add_llvm_library name)
+ cmake_parse_arguments(ARG
+ "SHARED"
+ ""
+ ""
+ ${ARGN})
if( BUILD_SHARED_LIBS )
llvm_add_library(${name} SHARED ${ARGN})
else()
@@ -418,12 +423,17 @@ macro(add_llvm_library name)
set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
else()
if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
- install(TARGETS ${name}
- EXPORT LLVMExports
- RUNTIME DESTINATION bin
- LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
- COMPONENT ${name})
+ if(ARG_SHARED OR BUILD_SHARED_LIBS)
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+ LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ COMPONENT ${name})
+ else()
+ install(TARGETS ${name}
+ EXPORT LLVMExports
+ ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}
+ COMPONENT ${name})
+ endif()
if (NOT CMAKE_CONFIGURATION_TYPES)
add_custom_target(install-${name}