Skip to content

Re-add LSL_BUILD_EXAMPLES option - #309

Open
myd7349 wants to merge 1 commit into
sccn:devfrom
SharpLSL:add-build-examples-option
Open

myd7349 wants to merge 1 commit into
sccn:devfrom
SharpLSL:add-build-examples-option

Conversation

@myd7349

@myd7349 myd7349 commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Examples are a useful way for users to learn how to use liblsl. While working on PR #304, I also found that building them alongside liblsl is useful for checking early whether the generated LSL::lsl target provides all the dependency information required by its consumers.

The examples were originally added in 70cc090 and removed in 5758c64. The removal addressed a real issue: the examples used find_package(LSL) to find in-tree artifacts, which could mask problems with the installed CMake package.

Currently, building the examples against an installed liblsl requires configuring and building liblsl, installing it, and then configuring and building the examples. With LSL_BUILD_EXAMPLES=ON, users can build liblsl and its examples with a single configuration and build.

Changes

  • Examples can be built as part of the liblsl project. In this mode, they link directly to the LSL::lsl target from the current build and do not call find_package(LSL).
  • Examples can still be configured as a standalone project. In this mode, they use find_package(LSL) to exercise the installed CMake package.
  • Install rules for the examples are enabled only when they are built as a standalone project.

Follow-up

Once PR #304 is merged, these three lines can be removed from examples/CMakeLists.txt, since the LSL::lsl target will already propagate the Threads dependency:

find_package(Threads)

# ...

target_link_libraries(TestSyncWithoutData PRIVATE Threads::Threads)
target_link_libraries(BenchmarkSyncVsAsync PRIVATE Threads::Threads)

Add an opt-in LSL_BUILD_EXAMPLES option (default OFF) to build the
examples alongside liblsl.

Examples can also still be configured as a standalone project to test
the installed CMake package. In standalone mode, the examples use
find_package(LSL) and install their targets; when included in the
liblsl build, they link directly to the existing LSL::lsl target.

The option was added in 70cc090 and
removed in 5758c64 because the
examples relied on in-tree artifacts, which could mask installation
issues.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant