mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
feat(Core/Build): add the possibility to link libraries dynamically (#5348)
This commit is contained in:
@@ -8,6 +8,14 @@ target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}")
|
||||
|
||||
set(CLANG_EXPECTED_VERSION 6.0.0)
|
||||
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS CLANG_EXPECTED_VERSION)
|
||||
message(FATAL_ERROR "Clang: AzerothCore requires version ${CLANG_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}")
|
||||
else()
|
||||
message(STATUS "Clang: Minimum version required is ${CLANG_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
|
||||
endif()
|
||||
|
||||
# This tests for a bug in clang-7 that causes linkage to fail for 64-bit from_chars (in some configurations)
|
||||
# If the clang requirement is bumped to >= clang-8, you can remove this check, as well as
|
||||
# the associated ifdef block in src/common/Utilities/StringConvert.h
|
||||
@@ -59,6 +67,20 @@ target_compile_options(acore-compile-option-interface
|
||||
-Wno-narrowing
|
||||
-Wno-deprecated-register)
|
||||
|
||||
target_compile_definitions(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-DDEBUG=1)
|
||||
if(BUILD_SHARED_LIBS)
|
||||
# -fPIC is needed to allow static linking in shared libs.
|
||||
# -fvisibility=hidden sets the default visibility to hidden to prevent exporting of all symbols.
|
||||
target_compile_options(acore-compile-option-interface
|
||||
INTERFACE
|
||||
-fPIC)
|
||||
|
||||
target_compile_options(acore-hidden-symbols-interface
|
||||
INTERFACE
|
||||
-fvisibility=hidden)
|
||||
|
||||
# --no-undefined to throw errors when there are undefined symbols
|
||||
# (caused through missing WARHEAD_*_API macros).
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --no-undefined")
|
||||
|
||||
message(STATUS "Clang: Disallow undefined symbols")
|
||||
endif()
|
||||
|
||||
Reference in New Issue
Block a user