From b3212163ecfc2dde84eaeb301fccc5bb0b624471 Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Mon, 25 May 2020 22:09:37 -0700 Subject: [PATCH] Support installation of a static library. --- src/libaatm/CMakeLists.txt | 32 ++++++++++++++++++++++++-------- src/test/CMakeLists.txt | 2 +- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/libaatm/CMakeLists.txt b/src/libaatm/CMakeLists.txt index 16ad59a..a620e55 100644 --- a/src/libaatm/CMakeLists.txt +++ b/src/libaatm/CMakeLists.txt @@ -1,6 +1,6 @@ -# Name of the internal static library -set(AATM_LIB aatm_) +# Name of the static library +set(AATM_STATIC aatm_static) # Name of loadable module / shared library set(AATM_MOD aatm) @@ -29,11 +29,22 @@ set(AATM_SOURCES src/ATMWVRMeasurement.cpp ) -# Add the internal library target +# Add the internal object library target -add_library(${AATM_LIB} STATIC ${AATM_SOURCES}) +add_library(aatmobj OBJECT ${AATM_SOURCES}) +set_property(TARGET aatmobj PROPERTY POSITION_INDEPENDENT_CODE 1) -target_include_directories(${AATM_LIB} PUBLIC +target_include_directories(aatmobj PRIVATE + $ + $ + src +) + +# Static library + +add_library(${AATM_STATIC} STATIC $) + +target_include_directories(${AATM_STATIC} PUBLIC $ $ PRIVATE src @@ -41,14 +52,19 @@ target_include_directories(${AATM_LIB} PUBLIC # Now define rules for the shared library -add_library(${AATM_MOD} SHARED ${AATM_SOURCES}) +add_library(${AATM_MOD} SHARED $) target_include_directories(${AATM_MOD} PUBLIC $ $ - PRIVATE . + PRIVATE src ) install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -install(TARGETS ${AATM_MOD} DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install( + TARGETS + ${AATM_MOD} + ${AATM_STATIC} + DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt index 6bda2ea..696dd31 100644 --- a/src/test/CMakeLists.txt +++ b/src/test/CMakeLists.txt @@ -1,6 +1,6 @@ # Name of the internal static library -set(AATM_LIB aatm_) +set(AATM_LIB aatm_static) #======================================================