Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 9c6f117b authored by Artur Grunau's avatar Artur Grunau
Browse files

Replace CAMPVIS_SHARED_LIBS with BUILD_SHARED_LIBS

CAMPVis used a custom option, CAMPVIS_SHARED_LIBS, to determine whether
shared or static libraries should be built. This option partially
duplicated the functionality of one of CMake's standard flags,
BUILD_SHARED_LIBS. The two could get out of sync, and because CMake only
consults BUILD_SHARED_LIBS when deciding how to build a library target,
it was possible to get inconsistent and broken build configurations.

To prevent that, add BUILD_SHARED_LIBS as an option to CAMPVis' main
CMakeLists and replace all references to CAMPVIS_SHARED_LIBS with
BUILD_SHARED_LIBS. This makes BUILD_SHARED_LIBS the only flag that
controls whether shared or static libraries are built.

References #367
parent 340c443b
......@@ -10,7 +10,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
# Global Build Options
#
OPTION(CAMPVIS_SHARED_LIBS "Build shared libraries?" ON)
OPTION(BUILD_SHARED_LIBS "Build shared libraries?" ON)
#OPTION(CAMPVIS_PRECOMPILED_HEADER "Use pre-compiled headers?" ON)
OPTION(CAMPVIS_DEBUG "Activate debug code?" ON)
OPTION(CAMPVIS_BUILD_APPLICATION "Build CAMPVis Application" ON)
......
......@@ -110,7 +110,7 @@ IF(WIN32)
SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /LARGEADDRESSAWARE")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
IF(CAMPVIS_SHARED_LIBS)
IF(BUILD_SHARED_LIBS)
# Linking against Windows DLLs requires explicit instantiation of templates
LIST(APPEND CampvisGlobalDefinitions "-DDLL_TEMPLATE_INST")
LIST(APPEND CampvisGlobalDefinitions "-DCAMPVIS_DYNAMIC_LIBS")
......
......@@ -5,11 +5,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
MESSAGE(STATUS "Configuring CAMPVis Core")
# configuration
IF(CAMPVIS_SHARED_LIBS)
SET(BUILD_SHARED_LIBS TRUE)
IF(MSVC)
ADD_DEFINITIONS("-DCAMPVIS_CORE_BUILD_DLL")
ENDIF()
IF(BUILD_SHARED_LIBS AND MSVC)
ADD_DEFINITIONS("-DCAMPVIS_CORE_BUILD_DLL")
ENDIF()
# glob sources from core directories
......@@ -62,4 +59,4 @@ TARGET_LINK_LIBRARIES(campvis-core tgt ${CampvisGlobalExternalLibs})
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisCoreSources ${CampvisHome} "")
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisCoreHeaders ${CampvisHome} "")
ENDIF()
\ No newline at end of file
ENDIF()
......@@ -14,11 +14,8 @@ IF(TGT_WITH_WMI)
LIST(APPEND CampvisGlobalExternalLibs "WbemUuid")
ENDIF(TGT_WITH_WMI)
IF(CAMPVIS_SHARED_LIBS)
SET(BUILD_SHARED_LIBS TRUE)
IF(MSVC)
ADD_DEFINITIONS("-DTGT_BUILD_DLL")
ENDIF()
IF(BUILD_SHARED_LIBS AND MSVC)
ADD_DEFINITIONS("-DTGT_BUILD_DLL")
ENDIF()
......
......@@ -17,7 +17,7 @@ LIST(APPEND CampvisModulesSources
LINK_DIRECTORIES(${CampvisGlobalLinkDirectories} ${CampvisModulesLinkDirectories})
ADD_LIBRARY(campvis-modules
ADD_LIBRARY(campvis-modules STATIC
${CampvisModulesSources} ${CampvisModulesHeaders}
)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment