Browse Source

Allow overriding BUILD_SHARED_LIBS via a project-specific cache variable

master
Martchus 2 months ago
parent
commit
6d0148e2c3
  1. 2
      CMakeLists.txt
  2. 8
      cmake/modules/3rdParty.cmake

2
CMakeLists.txt

@ -115,7 +115,7 @@ set(META_APP_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}")
set(META_APP_DESCRIPTION "Useful C++ classes and routines such as argument parser, IO and conversion utilities")
set(META_VERSION_MAJOR 5)
set(META_VERSION_MINOR 11)
set(META_VERSION_PATCH 1)
set(META_VERSION_PATCH 2)
# find required 3rd party libraries
include(3rdParty)

8
cmake/modules/3rdParty.cmake

@ -418,7 +418,13 @@ if (META_PROJECT_IS_LIBRARY)
if (ENABLE_DEVEL_DEFAULTS AND CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(BUILD_SHARED_LIBS_BY_DEFAULT ON)
endif ()
option(BUILD_SHARED_LIBS "whether to build shared or static libraries" "${BUILD_SHARED_LIBS_BY_DEFAULT}")
if (DEFINED CACHE{${META_PROJECT_VARNAME}_BUILD_SHARED_LIBS})
# allow overriding BUILD_SHARED_LIBS via a project-specific cache variable
set(BUILD_SHARED_LIBS "${${META_PROJECT_VARNAME}_BUILD_SHARED_LIBS}")
else ()
# make BUILD_SHARED_LIBS an overridable cache variable
option(BUILD_SHARED_LIBS "whether to build shared or static libraries" "${BUILD_SHARED_LIBS_BY_DEFAULT}")
endif ()
option(
STATIC_LIBRARY_LINKAGE
"prefer linking against dependencies statically; adds additional flags for static linkage; only applies when building shared libraries"

Loading…
Cancel
Save