Support BUILD_SHARED_LIBS cmake variable

This commit is contained in:
Dennis Klein 2018-09-19 18:19:55 +02:00
parent 0901655a65
commit 49a6e9389d
No known key found for this signature in database
GPG Key ID: 08E62D23FA0ECBBC
2 changed files with 6 additions and 1 deletions

View File

@ -32,7 +32,7 @@ configure_file(logger/Version.h.in
@ONLY
)
add_library(FairLogger SHARED
add_library(FairLogger
logger/Logger.cxx
logger/Logger.h
)
@ -64,6 +64,7 @@ install(TARGETS
EXPORT ${FairLogger_EXPORT_SET}
LIBRARY DESTINATION ${FairLogger_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${FairLogger_INSTALL_LIBDIR}
RUNTIME DESTINATION ${FairLogger_INSTALL_BINDIR}
)

View File

@ -125,6 +125,10 @@ macro(set_fairlogger_defaults)
# Generate compile_commands.json file (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
if(NOT BUILD_SHARED_LIBS)
set(BUILD_SHARED_LIBS ON CACHE BOOL "Whether to build shared libraries or static archives")
endif()
# Define CMAKE_INSTALL_*DIR family of variables
include(GNUInstallDirs)