Skip to content

cmake: allow to disable install and additional targets #238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,24 @@ include(cmake/Dependencies.cmake) #
include(cmake/SourceFiles.cmake) #
include(cmake/TargetObjLib.cmake) #
include(cmake/TargetLib.cmake) #
include(cmake/Installation.cmake) #
include(cmake/TargetOther.cmake)

if(LSL_INSTALL)
include(cmake/Installation.cmake) #
endif()

if(LSL_ADDITIONAL_TARGETS)
include(cmake/TargetOther.cmake)
endif()

if(LSL_UNITTESTS)
add_subdirectory(testing)
endif()

# Config for packaging
# TODO: Config for packaging for the library itself is likely to diverge from config for packing applications. e.g.,
# -> Optionally install to system directories
# -> Apple Framework -- different installer type; uses entitlements
LSLGenerateCPackConfig()

if(LSL_INSTALL)
# Config for packaging
# TODO: Config for packaging for the library itself is likely to diverge from config for packing applications. e.g.,
# -> Optionally install to system directories
# -> Apple Framework -- different installer type; uses entitlements
LSLGenerateCPackConfig()
endif()
4 changes: 4 additions & 0 deletions cmake/LSLCMake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ endfunction()
# After the target, additional libraries to install alongside the target can be
# specified, e.g. installLSLApp(FooApp libXY libZ)
function(installLSLApp target)
if(NOT LSL_INSTALL)
return()
endif()

get_target_property(TARGET_LIBRARIES ${target} LINK_LIBRARIES)
string(REGEX MATCH ";Qt[56]?::" qtapp ";${TARGET_LIBRARIES}")
if(qtapp)
Expand Down
2 changes: 2 additions & 0 deletions cmake/ProjectOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ option(LSL_LEGACY_CPP_ABI "Build legacy C++ ABI into lsl-static" OFF)
option(LSL_OPTIMIZATIONS "Enable some more compiler optimizations" ON)
option(LSL_BUNDLED_BOOST "Use the bundled Boost by default" ON)
option(LSL_BUNDLED_PUGIXML "Use the bundled pugixml by default" ON)
option(LSL_INSTALL "Create install targets for packaging the built libraries" ON)
option(LSL_ADDITIONAL_TARGETS "Build utility targets lslver and blackhole" ON)
option(LSL_TOOLS "Build some experimental tools for in-depth tests" OFF)
option(LSL_UNITTESTS "Build LSL library unit tests" OFF)
option(LSL_FORCE_FANCY_LIBNAME "Add library name decorations (32/64/-debug)" OFF)
Expand Down
Loading