diff --git a/BaseLib/BuildInfo.h b/BaseLib/BuildInfo.h index cc888557d63daa0055fa89ab0f5a6eb346367b89..1f0febe9ea508632797b4058884adcd8f20ec222 100644 --- a/BaseLib/BuildInfo.h +++ b/BaseLib/BuildInfo.h @@ -13,29 +13,31 @@ #include <string> +#include "baselib_export.h" + namespace BaseLib { namespace BuildInfo { - extern const std::string build_timestamp; + extern BASELIB_EXPORT const std::string build_timestamp; - extern const std::string cmake_cxx_compiler; - extern const std::string cmake_cxx_flags; - extern const std::string cmake_cxx_flags_release; - extern const std::string cmake_cxx_flags_debug; + extern BASELIB_EXPORT const std::string cmake_cxx_compiler; + extern BASELIB_EXPORT const std::string cmake_cxx_flags; + extern BASELIB_EXPORT const std::string cmake_cxx_flags_release; + extern BASELIB_EXPORT const std::string cmake_cxx_flags_debug; - extern const std::string git_version_sha1; - extern const std::string git_version_sha1_short; + extern BASELIB_EXPORT const std::string git_version_sha1; + extern BASELIB_EXPORT const std::string git_version_sha1_short; - extern const std::string git_describe; - extern const std::string ogs_version; + extern BASELIB_EXPORT const std::string git_describe; + extern BASELIB_EXPORT const std::string ogs_version; - extern const std::string source_path; - extern const std::string geo_xml_schema_path; - extern const std::string app_xml_schema_path; - extern const std::string data_path; - extern const std::string data_binary_path; - extern const std::string tests_tmp_path; + extern BASELIB_EXPORT const std::string source_path; + extern BASELIB_EXPORT const std::string geo_xml_schema_path; + extern BASELIB_EXPORT const std::string app_xml_schema_path; + extern BASELIB_EXPORT const std::string data_path; + extern BASELIB_EXPORT const std::string data_binary_path; + extern BASELIB_EXPORT const std::string tests_tmp_path; } } diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt index 377ac3b07a39aadfff758da72ba59383ff06957b..7feb6db73c2c96bc436fa4a69d84669698909298 100644 --- a/BaseLib/CMakeLists.txt +++ b/BaseLib/CMakeLists.txt @@ -12,12 +12,16 @@ list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/BuildInfo.cpp" BuildInfo.h) # Create the library add_library(BaseLib ${SOURCES}) +include(GenerateExportHeader) +generate_export_header(BaseLib) +target_include_directories(BaseLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) + set_target_properties(BaseLib PROPERTIES LINKER_LANGUAGE CXX) target_link_libraries(BaseLib PUBLIC logog) if(MSVC) - target_link_libraries(BaseLib PRIVATE WinMM) # needed for timeGetTime + target_link_libraries(BaseLib PUBLIC WinMM) # needed for timeGetTime endif() if(Qt5XmlPatterns_FOUND) diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 445216304f2d16a4c7508cbe009fec1eab1c4086..c313832dd534770dac73bd82fbedd2a7a2c91d04 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -29,10 +29,13 @@ elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "MSVC") set(COMPILER_IS_MSVC TRUE CACHE INTERNAL "") endif() # CMAKE_CXX_COMPILER_ID -# When static libraries are used in some shared libraries it is required that -# also the static libraries have position independent code. if(BUILD_SHARED_LIBS) + # When static libraries are used in some shared libraries it is required + # that also the static libraries have position independent code. set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + + # Enable Windows DLL support. + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) endif() # Set additional user-given compiler flags