1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
Author: Andreas Tille <tille@debian.org>
Last-Update: 2020-10-18
Description: Add static library
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -161,7 +161,7 @@ else()
endif()
# Find Boost for tests and utilities
-find_package(Boost COMPONENTS filesystem random program_options unit_test_framework)
+find_package(Boost REQUIRED COMPONENTS filesystem system random program_options unit_test_framework)
find_package(pugixml CONFIG REQUIRED)
find_package(FFTW COMPONENTS FLOAT_LIB)
@@ -246,11 +246,13 @@ if (BUILD_STATIC)
else()
set(ISMRMRD_PUGIXML_LIBRARIES pugixml::shared)
add_library(ismrmrd SHARED ${ISMRMRD_TARGET_SOURCES})
+ add_library(ismrmrd_static STATIC ${ISMRMRD_TARGET_SOURCES})
endif()
list(APPEND ISMRMRD_TARGET_LINK_LIBS ${ISMRMRD_PUGIXML_LIBRARIES})
target_include_directories(ismrmrd PUBLIC ${ISMRMRD_TARGET_INCLUDE_DIRS})
+target_include_directories(ismrmrd_static PUBLIC ${ISMRMRD_TARGET_INCLUDE_DIRS})
if (USE_HDF5_DATASET_SUPPORT)
target_compile_options(ismrmrd PUBLIC ${HDF5_DEFINITIONS})
endif()
@@ -271,7 +273,12 @@ set_target_properties(ismrmrd
VERSION ${ISMRMRD_VERSION_STRING}
SOVERSION ${ISMRMRD_SOVERSION})
+set_target_properties(ismrmrd_static
+ PROPERTIES
+ EXPORT_NAME ISMRMRD
+ OUTPUT_NAME "ismrmrd")
target_link_libraries(ismrmrd PUBLIC ${ISMRMRD_TARGET_LINK_LIBS})
+target_link_libraries(ismrmrd_static PUBLIC ${ISMRMRD_TARGET_LINK_LIBS})
list(APPEND ISMRMRD_LIBRARIES ismrmrd) # Add to list of libraries to be found
list(APPEND ISMRMRD_LIBRARY_DIRS ${CMAKE_BINARY_DIR} ) # Add to list of directories to find libraries
@@ -284,6 +291,7 @@ install(TARGETS ismrmrd EXPORT ISMRMRDTa
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
COMPONENT Devel
)
+install(TARGETS ismrmrd_static DESTINATION ${CMAKE_INSTALL_LIBDIR})
# install the headers
install(DIRECTORY include/ismrmrd DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} COMPONENT Devel)
|