Commit 739996fa authored by Artur Grunau's avatar Artur Grunau
Browse files

Use DEFINE_SYMBOL to define export flags

TGT and campvis-core used to manually define flags that instructed their
code to export DLL symbols. However, CMake has a property called
DEFINE_SYMBOL that can automatically define export flags when necessary.
Refactor the CMakeLists of TGT and campvis-core to make use of it.

References #367
parent 9c6f117b
......@@ -4,10 +4,6 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0 FATAL_ERROR)
MESSAGE(STATUS "Configuring CAMPVis Core")
# configuration
IF(BUILD_SHARED_LIBS AND MSVC)
ADD_DEFINITIONS("-DCAMPVIS_CORE_BUILD_DLL")
ENDIF()
# glob sources from core directories
FILE(GLOB CampvisCoreSources RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
......@@ -55,6 +51,10 @@ ADD_DEFINITIONS(${CampvisGlobalDefinitions})
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs})
TARGET_LINK_LIBRARIES(campvis-core tgt ${CampvisGlobalExternalLibs})
# if campvis-core is built as a shared library, CMake will define the following flag to instruct
# the code to export DLL symbols
SET_TARGET_PROPERTIES(campvis-core PROPERTIES DEFINE_SYMBOL "CAMPVIS_CORE_BUILD_DLL")
IF(CAMPVIS_GROUP_SOURCE_FILES)
DEFINE_SOURCE_GROUPS_FROM_SUBDIR(CampvisCoreSources ${CampvisHome} "")
......
......@@ -14,10 +14,6 @@ IF(TGT_WITH_WMI)
LIST(APPEND CampvisGlobalExternalLibs "WbemUuid")
ENDIF(TGT_WITH_WMI)
IF(BUILD_SHARED_LIBS AND MSVC)
ADD_DEFINITIONS("-DTGT_BUILD_DLL")
ENDIF()
# headers
FILE(GLOB TGT_HEADERS *.h event/*.h navigation/*.h)
......@@ -97,6 +93,11 @@ ADD_DEFINITIONS(${CampvisGlobalDefinitions} ${CampvisModulesDefinitions} ${QT_DE
INCLUDE_DIRECTORIES(${CampvisGlobalIncludeDirs} ${CampvisModulesIncludeDirs})
TARGET_LINK_LIBRARIES(tgt ${CampvisGlobalExternalLibs} ${QT_LIBRARIES})
# if TGT is built as a shared library, CMake will define the following flag to instruct the code to
# export DLL symbols
SET_TARGET_PROPERTIES(tgt PROPERTIES DEFINE_SYMBOL "TGT_BUILD_DLL")
################################################################################
# deployment
################################################################################
......
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