diff options
Diffstat (limited to 'src/cmake/compiler/clang/settings.cmake')
-rw-r--r-- | src/cmake/compiler/clang/settings.cmake | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/src/cmake/compiler/clang/settings.cmake b/src/cmake/compiler/clang/settings.cmake index 32234085cf..fecfb2edc4 100644 --- a/src/cmake/compiler/clang/settings.cmake +++ b/src/cmake/compiler/clang/settings.cmake @@ -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() |