Use groups in CMake install command for libraries

On Windows shared libraries should be installed into the bin directory. Using grouping within CMake based on the target type fixes this issue.
This commit is contained in:
Don
2018-03-16 13:59:26 -07:00
parent 639a6629ae
commit 5fb488de9f
3 changed files with 31 additions and 18 deletions

View File

@@ -37,7 +37,9 @@ else()
endif()
add_library(tls-objects OBJECT ${TLS_SRC})
set(TLS_LIBRARIES tls)
if (BUILD_SHARED)
list(APPEND TLS_LIBRARIES tls-shared)
add_library(tls STATIC $<TARGET_OBJECTS:tls-objects>)
add_library(tls-shared SHARED $<TARGET_OBJECTS:tls-objects>)
export_symbol(tls-shared ${CMAKE_CURRENT_SOURCE_DIR}/tls.sym)
@@ -51,13 +53,15 @@ if (BUILD_SHARED)
ARCHIVE_OUTPUT_NAME tls${TLS_POSTFIX})
set_target_properties(tls-shared PROPERTIES VERSION ${TLS_VERSION}
SOVERSION ${TLS_MAJOR_VERSION})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS tls tls-shared DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
else()
add_library(tls STATIC ${TLS_SRC})
if(ENABLE_LIBRESSL_INSTALL)
install(TARGETS tls DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(ENABLE_LIBRESSL_INSTALL)
endif()
if(ENABLE_LIBRESSL_INSTALL)
install(
TARGETS ${TLS_LIBRARIES}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
endif(ENABLE_LIBRESSL_INSTALL)