sccn / liblsl

C++ lsl library for multi-modal time-synched data transmission over the local network
Other
108 stars 63 forks source link

Add lsl-static to installed targets if LSL_BUILD_STATIC option is ON #30

Closed arthurbiancarelli closed 4 years ago

arthurbiancarelli commented 4 years ago

I'm not sure if it makes sense to "install" a static library, but in my project I find useful to do:

find_package(LSL)
...
target_link_library(${TARGET_NAME} LSL::lsl-static

First time contributing, I hope I fulfill the requirements

tstenner commented 4 years ago

Something like this has been possible before, but we're in the process of overhauling the build regarding static and shared libraries (see #27).

In short: currently, CMake builds each file twice, once for the static and once for the shared library. With the PR, CMake would build a bunch of object files and link them into a static and a shared library, effectively halving the build time.

The PR in itself is fine, but I'd rather address this after #27. What's your use case for this?

arthurbiancarelli commented 4 years ago

Ok thanks for your reply it can wait. It would be a nice add-on to build object files first.

I'm developing a personal project using LSL library and I wish to link the library statically to have everything bundled in the same executable (and not have dynamic link dependencies which it's causing me some problems, especially on Windows) . Since I'm using CMake for my project too I find it useful to use find_package on LSL library. Hence the need to add the lsl-static to the list of exported targets.

cboulay commented 4 years ago

@arthurbiancarelli , #27 has now been merged. Do you mind rebasing your PR?

tstenner commented 4 years ago

It's already in there, so I'll just close this.

arthurbiancarelli commented 4 years ago

perfect thanks