Skip to content

Commit 0f7bdc2

Browse files
committed
wrap pugixml > lslobj > lsl internal dependencies with $<BUILD_INTERFACE:...> because pugixml and lslobj are not needed in the export set
1 parent 87f8fe3 commit 0f7bdc2

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

cmake/Installation.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,9 @@ write_basic_package_version_file(
4141
)
4242

4343
# Define installation targets
44+
# Note: We only export the final 'lsl' library, not intermediate targets like lslobj.
45+
# Consumers should link to LSL::lsl, not internal object libraries.
4446
set(LSLTargets lsl)
45-
if(LSL_BUILD_STATIC)
46-
list(APPEND LSLTargets lslobj lslboost)
47-
endif()
4847

4948
# Install the targets and store configuration information.
5049
install(TARGETS ${LSLTargets}

cmake/TargetLib.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ endif()
2828
# Link dependencies. The only dependency is lslobj, which contains the bulk of the library code and linkages.
2929
# Note: We link PRIVATE because lslobj exposes extra symbols that are not part of the public API
3030
# but are used by the internal tests.
31-
target_link_libraries(lsl PRIVATE lslobj)
31+
# Note: We use BUILD_INTERFACE to avoid requiring lslobj in the export set - the object library's
32+
# objects are linked directly into lsl, so consumers don't need lslobj.
33+
target_link_libraries(lsl PRIVATE $<BUILD_INTERFACE:lslobj>)
3234

3335
# Set the include directories for the lsl target.
3436
# Note: We had to link lslobj as a PRIVATE dependency, therefore we must manually expose the include directories

cmake/TargetObjLib.cmake

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ if(NOT LSL_OPTIMIZATIONS)
8080
endif()
8181

8282
# - pugixml (fetched via FetchContent, linked statically and privately)
83-
target_link_libraries(lslobj PRIVATE pugixml::pugixml)
83+
# Use BUILD_INTERFACE to avoid requiring pugixml in the export set - the static
84+
# library objects are linked into lsl directly, so consumers don't need pugixml.
85+
target_link_libraries(lslobj PRIVATE $<BUILD_INTERFACE:pugixml::pugixml>)
8486
# Hide pugixml symbols from the shared library on Linux
8587
if(UNIX AND NOT APPLE)
8688
target_link_options(lslobj PRIVATE "LINKER:--exclude-libs,libpugixml.a")

0 commit comments

Comments
 (0)