|
1 | 1 |
|
2 |
| -# Name of the internal static library |
3 |
| -set(AATM_LIB aatm_) |
| 2 | +# Name of the static library |
| 3 | +set(AATM_STATIC aatm_static) |
4 | 4 |
|
5 | 5 | # Name of loadable module / shared library
|
6 | 6 | set(AATM_MOD aatm)
|
@@ -29,26 +29,42 @@ set(AATM_SOURCES
|
29 | 29 | src/ATMWVRMeasurement.cpp
|
30 | 30 | )
|
31 | 31 |
|
32 |
| -# Add the internal library target |
| 32 | +# Add the internal object library target |
33 | 33 |
|
34 |
| -add_library(${AATM_LIB} STATIC ${AATM_SOURCES}) |
| 34 | +add_library(aatmobj OBJECT ${AATM_SOURCES}) |
| 35 | +set_property(TARGET aatmobj PROPERTY POSITION_INDEPENDENT_CODE 1) |
35 | 36 |
|
36 |
| -target_include_directories(${AATM_LIB} PUBLIC |
| 37 | +target_include_directories(aatmobj PRIVATE |
| 38 | + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> |
| 39 | + $<INSTALL_INTERFACE:include> |
| 40 | + src |
| 41 | +) |
| 42 | + |
| 43 | +# Static library |
| 44 | + |
| 45 | +add_library(${AATM_STATIC} STATIC $<TARGET_OBJECTS:aatmobj>) |
| 46 | + |
| 47 | +target_include_directories(${AATM_STATIC} PUBLIC |
37 | 48 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
38 | 49 | $<INSTALL_INTERFACE:include>
|
39 | 50 | PRIVATE src
|
40 | 51 | )
|
41 | 52 |
|
42 | 53 | # Now define rules for the shared library
|
43 | 54 |
|
44 |
| -add_library(${AATM_MOD} SHARED ${AATM_SOURCES}) |
| 55 | +add_library(${AATM_MOD} SHARED $<TARGET_OBJECTS:aatmobj>) |
45 | 56 |
|
46 | 57 | target_include_directories(${AATM_MOD} PUBLIC
|
47 | 58 | $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
48 | 59 | $<INSTALL_INTERFACE:include>
|
49 |
| - PRIVATE . |
| 60 | + PRIVATE src |
50 | 61 | )
|
51 | 62 |
|
52 | 63 | install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
53 | 64 |
|
54 |
| -install(TARGETS ${AATM_MOD} DESTINATION ${CMAKE_INSTALL_LIBDIR}) |
| 65 | +install( |
| 66 | + TARGETS |
| 67 | + ${AATM_MOD} |
| 68 | + ${AATM_STATIC} |
| 69 | + DESTINATION ${CMAKE_INSTALL_LIBDIR} |
| 70 | +) |
0 commit comments