From ddba0731c54e3fc437887372c9fcf10f2d163ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Sat, 16 Aug 2025 10:58:50 -0400 Subject: [PATCH] cmake: allow to disable install and additional targets --- CMakeLists.txt | 23 ++++++++++++++++------- cmake/LSLCMake.cmake | 4 ++++ cmake/ProjectOptions.cmake | 2 ++ 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c4e0dea1..d45b28e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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() diff --git a/cmake/LSLCMake.cmake b/cmake/LSLCMake.cmake index f64b001b..61abc419 100644 --- a/cmake/LSLCMake.cmake +++ b/cmake/LSLCMake.cmake @@ -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) diff --git a/cmake/ProjectOptions.cmake b/cmake/ProjectOptions.cmake index 48f4c565..d1f97d7e 100644 --- a/cmake/ProjectOptions.cmake +++ b/cmake/ProjectOptions.cmake @@ -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)