Skip to content

Commit 7f7e13b

Browse files
committed
CMake: add object libraries to the export set for static builds
The dependencies' object files are combined into a single library file. For static libraries, the usage flags (include directories, compile definitions) are copied by reference rather than by value so the object libraries are needed in the export set.
1 parent e846ed1 commit 7f7e13b

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

CMakeLists.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ if(LSL_BUNDLED_PUGIXML)
114114
message(STATUS "Using bundled pugixml")
115115
target_sources(lslobj PRIVATE thirdparty/pugixml/pugixml.cpp)
116116
target_include_directories(lslobj SYSTEM PUBLIC
117-
${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml)
117+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/thirdparty/pugixml>)
118118
else()
119119
message(STATUS "Using system pugixml")
120120
find_package(pugixml REQUIRED)
@@ -178,7 +178,7 @@ target_compile_definitions(lslboost
178178
BOOST_THREAD_DONT_PROVIDE_INTERRUPTIONS
179179
)
180180
target_include_directories(lslboost SYSTEM PUBLIC
181-
${CMAKE_CURRENT_SOURCE_DIR}/lslboost)
181+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/lslboost>)
182182

183183
# target configuration for the internal lslobj target
184184
target_link_libraries(lslobj PRIVATE lslboost)
@@ -273,7 +273,12 @@ write_basic_package_version_file(
273273
COMPATIBILITY AnyNewerVersion
274274
)
275275

276-
install(TARGETS lsl
276+
set(LSLTargets lsl)
277+
if(LSL_BUILD_STATIC)
278+
list(APPEND LSLTargets lslobj lslboost)
279+
endif()
280+
281+
install(TARGETS ${LSLTargets}
277282
EXPORT LSLTargets
278283
COMPONENT liblsl
279284
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

0 commit comments

Comments
 (0)