Allow installing static lib - #169
Conversation
dg0yt
left a comment
There was a problem hiding this comment.
Only a cursory review, coming from the vcpkg PR.
| lazperf_add_library(${LAZPERF_SHARED_LIB} SHARED ${SRCS}) | ||
| endif() | ||
| lazperf_add_library(${LAZPERF_STATIC_LIB} STATIC ${SRCS}) | ||
| lazperf_add_library(${LAZPERF_LIB} ${SRCS}) |
There was a problem hiding this comment.
If you want the lib target to stand out where used here and downstream, do the next step and add a namespaced alias.
| lazperf_add_library(${LAZPERF_LIB} ${SRCS}) | |
| lazperf_add_library(lazperf ${SRCS}) | |
| add_library(lazperf::lazperf ALIAS lazperf) |
(IDK if it should be here or in lazperf_add_library.)
There was a problem hiding this comment.
There's a namespace defined in install.cmake, would that need to be dropped instead?
Lines 27 to 28 in 2c21fa0
There was a problem hiding this comment.
If the namespace is already defined, it should be used.
Nothing needs to be dropped from installation. The proposed alias is for sub-project usage.
So it wouldn't matter downstream if the project is used as a sub-project or from an installation.
(LAZPERF::lazperf? TBH I prefer when package name, namespace and main target do not use different spellings. There could be LAZPERF::LAZPERF or lazperf::lazperf.)
There was a problem hiding this comment.
Proposed lazperf::lazperf now since package and target already are lowercase, so namespace is now aligned too. I am open to reverting that if this is not desired.
|
Thanks @dg0yt |
|
Windows and wasm builds not healthy with these changes. |
LAZPERF_EXPORT is only redefined to dllimport on installation, this isn't functional inside the source code
|
wasm build still failing with
|
This builds and installs either the static or shared lib.
The behavior is controlled through BUILD_SHARED_LIBS.
cmake -DBUILD_SHARED_LIBS=OFFwill build as static library.The default is a dynamic library to replicate the original behavior of installing a shared library if no options are provided.
Aligns the target namespace with the package name (lowercase
lazperf).Internally uses the namespaced target
lazperf::lazperffor linking.Implements #168