aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-07-15 15:24:35 +0200
committerShauren <shauren.trinity@gmail.com>2024-07-15 15:24:35 +0200
commit77fe2745febab9e4362b09750093d831325e6091 (patch)
tree5ba9fa4dfe061dc304cedd80c5632d5460966ab7
parentd4998bd04a27237aba635401d5aff0d7aafa12e5 (diff)
Build: CMake cleanup
* Migrate all add_definitions to target_compile_definitions * Remove -D from preprocessor definitions added by target_compile_definitions (unneccessary, cmake strips it anyway) * Fixed NO_BUFFERPOOL not being set on g3d if jemalloc is used * Moved library/compiler specific compile flag settings spread all over various CMakeLists to their related library/compiler file * Remove ancient manual link flag settings for worldserver
-rw-r--r--cmake/compiler/clang/settings.cmake2
-rw-r--r--cmake/compiler/gcc/settings.cmake8
-rw-r--r--cmake/compiler/icc/settings.cmake4
-rw-r--r--cmake/compiler/msvc/settings.cmake14
-rw-r--r--cmake/macros/ConfigureBaseTargets.cmake2
-rw-r--r--cmake/platform/win/settings.cmake12
-rw-r--r--cmake/showoptions.cmake49
-rw-r--r--dep/CascLib/CMakeLists.txt2
-rw-r--r--dep/SFMT/CMakeLists.txt6
-rw-r--r--dep/argon2/CMakeLists.txt2
-rw-r--r--dep/boost/CMakeLists.txt25
-rw-r--r--dep/g3dlite/CMakeLists.txt6
-rw-r--r--dep/gsoap/CMakeLists.txt4
-rw-r--r--dep/jemalloc/CMakeLists.txt6
-rw-r--r--dep/openssl_ed25519/CMakeLists.txt2
-rw-r--r--dep/protobuf/CMakeLists.txt8
-rw-r--r--dep/rapidjson/CMakeLists.txt6
-rw-r--r--src/common/CMakeLists.txt15
-rw-r--r--src/server/CMakeLists.txt8
-rw-r--r--src/server/database/CMakeLists.txt13
-rw-r--r--src/server/game/CMakeLists.txt6
-rw-r--r--src/server/proto/CMakeLists.txt6
-rw-r--r--src/server/shared/CMakeLists.txt6
-rw-r--r--src/server/worldserver/CMakeLists.txt6
24 files changed, 110 insertions, 108 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake
index 1ff7fcb2422..235a2618e2f 100644
--- a/cmake/compiler/clang/settings.cmake
+++ b/cmake/compiler/clang/settings.cmake
@@ -35,7 +35,7 @@ if (NOT CLANG_HAVE_PROPER_CHARCONV)
message(STATUS "Clang: Detected from_chars bug for 64-bit integers, workaround enabled")
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -DTRINITY_NEED_CHARCONV_WORKAROUND)
+ TRINITY_NEED_CHARCONV_WORKAROUND)
endif()
if(WITH_WARNINGS)
diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake
index e830d28b655..3806ffee984 100644
--- a/cmake/compiler/gcc/settings.cmake
+++ b/cmake/compiler/gcc/settings.cmake
@@ -6,6 +6,10 @@ else()
message(STATUS "GCC: Minimum version required is ${GCC_EXPECTED_VERSION}, found ${CMAKE_CXX_COMPILER_VERSION} - ok!")
endif()
+target_compile_options(trinity-compile-option-interface
+ INTERFACE
+ -fno-delete-null-pointer-checks)
+
if(PLATFORM EQUAL 32)
# Required on 32-bit systems to enable SSE2 (standard on x64)
target_compile_options(trinity-compile-option-interface
@@ -16,8 +20,8 @@ endif()
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -DHAVE_SSE2
- -D__SSE2__)
+ HAVE_SSE2
+ __SSE2__)
message(STATUS "GCC: SFMT enabled, SSE2 flags forced")
endif()
diff --git a/cmake/compiler/icc/settings.cmake b/cmake/compiler/icc/settings.cmake
index 87187cc3a5c..a17e2c45d2a 100644
--- a/cmake/compiler/icc/settings.cmake
+++ b/cmake/compiler/icc/settings.cmake
@@ -1,7 +1,3 @@
-target_compile_definitions(trinity-compile-option-interface
- INTERFACE
- -D_BUILD_DIRECTIVE="$<CONFIG>")
-
if(PLATFORM EQUAL 32)
target_compile_options(trinity-compile-option-interface
INTERFACE
diff --git a/cmake/compiler/msvc/settings.cmake b/cmake/compiler/msvc/settings.cmake
index b7f67874329..50dac95f123 100644
--- a/cmake/compiler/msvc/settings.cmake
+++ b/cmake/compiler/msvc/settings.cmake
@@ -34,7 +34,7 @@ if(PLATFORM EQUAL 64)
# debugger functionality.
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_WIN64)
+ _WIN64)
message(STATUS "MSVC: 64-bit platform, enforced -D_WIN64 parameter")
@@ -88,24 +88,24 @@ endif()
# Define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES - eliminates the warning by changing the strcpy call to strcpy_s, which prevents buffer overruns
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
+ _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES)
message(STATUS "MSVC: Overloaded standard names")
# Ignore warnings about older, less secure functions
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_CRT_SECURE_NO_WARNINGS)
+ _CRT_SECURE_NO_WARNINGS)
message(STATUS "MSVC: Disabled NON-SECURE warnings")
# Ignore warnings about POSIX deprecation
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_CRT_NONSTDC_NO_WARNINGS)
+ _CRT_NONSTDC_NO_WARNINGS)
# Force math constants like M_PI to be available
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_USE_MATH_DEFINES)
+ _USE_MATH_DEFINES)
message(STATUS "MSVC: Disabled POSIX warnings")
@@ -157,8 +157,8 @@ target_compile_options(trinity-compile-option-interface
if(ASAN)
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_DISABLE_STRING_ANNOTATION
- -D_DISABLE_VECTOR_ANNOTATION)
+ _DISABLE_STRING_ANNOTATION
+ _DISABLE_VECTOR_ANNOTATION)
target_compile_options(trinity-compile-option-interface
INTERFACE
diff --git a/cmake/macros/ConfigureBaseTargets.cmake b/cmake/macros/ConfigureBaseTargets.cmake
index 34ed3170044..77a66d085b2 100644
--- a/cmake/macros/ConfigureBaseTargets.cmake
+++ b/cmake/macros/ConfigureBaseTargets.cmake
@@ -18,7 +18,7 @@ set(CMAKE_CXX_STANDARD 20)
# Set build-directive (used in core to tell which buildtype we used)
target_compile_definitions(trinity-compile-option-interface
INTERFACE
- -D_BUILD_DIRECTIVE="$<CONFIG>")
+ _BUILD_DIRECTIVE="$<CONFIG>")
# An interface library to make the target features available to other targets
add_library(trinity-feature-interface INTERFACE)
diff --git a/cmake/platform/win/settings.cmake b/cmake/platform/win/settings.cmake
index 36319ab23ec..efae7696e17 100644
--- a/cmake/platform/win/settings.cmake
+++ b/cmake/platform/win/settings.cmake
@@ -1,8 +1,10 @@
-add_definitions(-D_WIN32_WINNT=0x0A00) # Windows 10
-add_definitions(-DNTDDI_VERSION=0x0A000007) # 19H1 (1903)
-add_definitions(-DWIN32_LEAN_AND_MEAN)
-add_definitions(-DNOMINMAX)
-add_definitions(-DTRINITY_REQUIRED_WINDOWS_BUILD=18362)
+target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ _WIN32_WINNT=0x0A00 # Windows 10
+ NTDDI_VERSION=0x0A000007 # 19H1 (1903)
+ WIN32_LEAN_AND_MEAN
+ NOMINMAX
+ TRINITY_REQUIRED_WINDOWS_BUILD=18362)
# set up output paths for executable binaries (.exe-files, and .dll-files on DLL-capable platforms)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin/$<CONFIG>")
diff --git a/cmake/showoptions.cmake b/cmake/showoptions.cmake
index 9ea4a13199c..12cf83a467e 100644
--- a/cmake/showoptions.cmake
+++ b/cmake/showoptions.cmake
@@ -1,7 +1,8 @@
# output generic information about the core and buildtype chosen
message("")
message("* TrinityCore revision : ${rev_hash} ${rev_date} (${rev_branch} branch)")
-if(NOT ("${CMAKE_GENERATOR}" MATCHES "Visual Studio" OR "${CMAKE_GENERATOR}" STREQUAL "Ninja Multi-Config"))
+get_property(IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
+if(NOT IS_MULTI_CONFIG)
message("* TrinityCore buildtype : ${CMAKE_BUILD_TYPE}")
endif()
message("")
@@ -72,7 +73,9 @@ if(WITH_COREDEBUG)
message(" *** -DCMAKE_BUILD_TYPE=RelWithDebInfo")
message(" *** DO NOT ENABLE IT UNLESS YOU KNOW WHAT YOU'RE DOING!")
message("* Use coreside debug : Yes")
- add_definitions(-DTRINITY_DEBUG)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ TRINITY_DEBUG)
else()
message("* Use coreside debug : No (default)")
endif()
@@ -111,60 +114,70 @@ if(HELGRIND)
message(" *** HELGRIND - WARNING!")
message(" *** Please specify the valgrind include directory in VALGRIND_INCLUDE_DIR option if you get build errors")
message(" *** Please note that this is for DEBUGGING WITH HELGRIND only!")
- add_definitions(-DHELGRIND)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ HELGRIND)
endif()
if(ASAN)
message("")
message(" *** ASAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH ADDRESS SANITIZER only!")
- add_definitions(-DASAN)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ ASAN)
endif()
if(MSAN)
message("")
message(" *** MSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH MEMORY SANITIZER only!")
- add_definitions(-DMSAN)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ MSAN)
endif()
if(UBSAN)
message("")
message(" *** UBSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH UNDEFINED BEHAVIOR SANITIZER only!")
- add_definitions(-DUBSAN)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ UBSAN)
endif()
if(TSAN)
message("")
message(" *** TSAN - WARNING!")
message(" *** Please note that this is for DEBUGGING WITH THREAD SANITIZER only!")
- add_definitions(-DTSAN -DNO_BUFFERPOOL)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ TSAN)
endif()
if(PERFORMANCE_PROFILING)
message("")
message(" *** PERFORMANCE_PROFILING - WARNING!")
message(" *** Please note that this is for PERFORMANCE PROFILING only! Do NOT report any issue when enabling this configuration!")
- add_definitions(-DPERFORMANCE_PROFILING)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ PERFORMANCE_PROFILING)
endif()
if(WITHOUT_METRICS)
message("")
message(" *** WITHOUT_METRICS - WARNING!")
message(" *** Please note that this will disable all metrics output (i.e. InfluxDB and Grafana)")
- add_definitions(-DWITHOUT_METRICS)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ WITHOUT_METRICS)
elseif (WITH_DETAILED_METRICS)
message("")
message(" *** WITH_DETAILED_METRICS - WARNING!")
message(" *** Please note that this will enable detailed metrics output (i.e. time each session takes to update)")
- add_definitions(-DWITH_DETAILED_METRICS)
-endif()
-
-if(WITH_BOOST_STACKTRACE)
- if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE)
- add_definitions(-DBOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE="${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE}")
- endif()
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ WITH_DETAILED_METRICS)
endif()
if(BUILD_SHARED_LIBS)
@@ -176,7 +189,9 @@ if(BUILD_SHARED_LIBS)
message("")
message(" *** Dynamic linking was enforced through a dynamic script module!")
endif()
- add_definitions(-DTRINITY_API_USE_DYNAMIC_LINKING)
+ target_compile_definitions(trinity-compile-option-interface
+ INTERFACE
+ TRINITY_API_USE_DYNAMIC_LINKING)
WarnAboutSpacesInBuildPath()
endif()
diff --git a/dep/CascLib/CMakeLists.txt b/dep/CascLib/CMakeLists.txt
index e27710ffe18..b1a1e90b5e6 100644
--- a/dep/CascLib/CMakeLists.txt
+++ b/dep/CascLib/CMakeLists.txt
@@ -59,7 +59,7 @@ target_include_directories(casc
PRIVATE
${CMAKE_SOURCE_DIR}/dep)
-target_compile_definitions(casc PUBLIC -D__SYS_ZLIB -DCASCLIB_NO_AUTO_LINK_LIBRARY -DCASCLIB_NODEBUG)
+target_compile_definitions(casc PUBLIC __SYS_ZLIB CASCLIB_NO_AUTO_LINK_LIBRARY CASCLIB_NODEBUG)
target_link_libraries(casc
PRIVATE
diff --git a/dep/SFMT/CMakeLists.txt b/dep/SFMT/CMakeLists.txt
index 117fae8ba4c..700118e9b5f 100644
--- a/dep/SFMT/CMakeLists.txt
+++ b/dep/SFMT/CMakeLists.txt
@@ -36,7 +36,7 @@ target_include_directories(sfmt
${CMAKE_CURRENT_SOURCE_DIR})
# using the standard Mersenne exponent 19937
-target_compile_definitions(sfmt PUBLIC -DSFMT_MEXP=19937)
+target_compile_definitions(sfmt PUBLIC SFMT_MEXP=19937)
# enable SIMD instructions if available
include(CheckCXXCompilerFlag)
@@ -67,11 +67,11 @@ else ()
endif ()
if (HAVE_NEON)
- target_compile_definitions(sfmt PUBLIC -DHAVE_NEON)
+ target_compile_definitions(sfmt PUBLIC HAVE_NEON)
endif ()
if (HAVE_SSE2)
- target_compile_definitions(sfmt PUBLIC -DHAVE_SSE2)
+ target_compile_definitions(sfmt PUBLIC HAVE_SSE2)
endif ()
set_target_properties(sfmt PROPERTIES LINKER_LANGUAGE CXX)
diff --git a/dep/argon2/CMakeLists.txt b/dep/argon2/CMakeLists.txt
index f503afaa6d9..7b9a993e2a2 100644
--- a/dep/argon2/CMakeLists.txt
+++ b/dep/argon2/CMakeLists.txt
@@ -23,7 +23,7 @@ add_library(argon2 STATIC
target_compile_definitions(argon2
PRIVATE
- -DARGON2_NO_THREADS)
+ ARGON2_NO_THREADS)
set_target_properties(argon2 PROPERTIES LINKER_LANGUAGE CXX)
diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt
index 4bf2c3feaa7..b374a88989e 100644
--- a/dep/boost/CMakeLists.txt
+++ b/dep/boost/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
set(Boost_NO_WARN_NEW_VERSIONS ON)
-include (CheckCXXSourceCompiles)
-
if (WIN32)
# On windows the requirements are higher according to the wiki.
set(BOOST_REQUIRED_VERSION 1.78)
@@ -49,19 +47,24 @@ target_include_directories(boost
target_compile_definitions(boost
INTERFACE
- -DBOOST_ALL_NO_LIB
- -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
- -DBOOST_ASIO_NO_DEPRECATED
- -DBOOST_BIND_NO_PLACEHOLDERS
- -DBOOST_SYSTEM_USE_UTF8)
+ BOOST_ALL_NO_LIB
+ BOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE
+ BOOST_ASIO_NO_DEPRECATED
+ BOOST_BIND_NO_PLACEHOLDERS
+ BOOST_SYSTEM_USE_UTF8)
if (WITH_BOOST_STACKTRACE AND NOT WIN32)
- message("*** libbacktrace will be linked")
+ message(STATUS "libbacktrace will be linked")
+
+ include(CheckIncludeFile)
if (BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE)
- CHECK_INCLUDE_FILE(${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE} HAS_BACKTRACE)
+ check_include_file("${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE}" HAS_BACKTRACE)
+ target_compile_definitions(boost
+ INTERFACE
+ BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE=${BOOST_STACKTRACE_BACKTRACE_INCLUDE_FILE})
else()
- CHECK_INCLUDE_FILE("backtrace.h" HAS_BACKTRACE)
+ check_include_file("backtrace.h" HAS_BACKTRACE)
endif()
if (NOT HAS_BACKTRACE)
@@ -70,7 +73,7 @@ if (WITH_BOOST_STACKTRACE AND NOT WIN32)
target_compile_definitions(boost
INTERFACE
- -DBOOST_STACKTRACE_USE_BACKTRACE)
+ BOOST_STACKTRACE_USE_BACKTRACE)
target_link_libraries(boost
INTERFACE
diff --git a/dep/g3dlite/CMakeLists.txt b/dep/g3dlite/CMakeLists.txt
index 90d2280cc7b..fc22b4e10b8 100644
--- a/dep/g3dlite/CMakeLists.txt
+++ b/dep/g3dlite/CMakeLists.txt
@@ -60,6 +60,12 @@ target_include_directories(g3dlib
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/include)
+if((CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM) OR TSAN)
+ target_compile_definitions(g3dlib
+ PRIVATE
+ NO_BUFFERPOOL)
+endif()
+
target_link_libraries(g3dlib
PRIVATE
trinity-dependency-interface
diff --git a/dep/gsoap/CMakeLists.txt b/dep/gsoap/CMakeLists.txt
index cd5bc0ad085..77fb50d1e87 100644
--- a/dep/gsoap/CMakeLists.txt
+++ b/dep/gsoap/CMakeLists.txt
@@ -20,7 +20,7 @@ target_include_directories(gsoap
target_compile_definitions(gsoap
PUBLIC
- -DWITH_OPENSSL)
+ WITH_OPENSSL)
target_link_libraries(gsoap
PRIVATE
@@ -37,5 +37,5 @@ if (MSVC)
# Little fix for MSVC / Windows platforms
target_compile_definitions(gsoap
PRIVATE
- -D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
+ _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=0)
endif()
diff --git a/dep/jemalloc/CMakeLists.txt b/dep/jemalloc/CMakeLists.txt
index 42bc5fd51e4..48e7c36d9de 100644
--- a/dep/jemalloc/CMakeLists.txt
+++ b/dep/jemalloc/CMakeLists.txt
@@ -91,11 +91,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Linux" AND NOT NOJEM)
${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_definitions(jemalloc
- PUBLIC
- -DNO_BUFFERPOOL
PRIVATE
- -D_GNU_SOURCE
- -D_REENTRAN)
+ _GNU_SOURCE
+ _REENTRAN)
target_link_libraries(jemalloc
PRIVATE
diff --git a/dep/openssl_ed25519/CMakeLists.txt b/dep/openssl_ed25519/CMakeLists.txt
index eddfb1c20c4..946aaaf7f3b 100644
--- a/dep/openssl_ed25519/CMakeLists.txt
+++ b/dep/openssl_ed25519/CMakeLists.txt
@@ -25,7 +25,7 @@ target_include_directories(openssl_ed25519
target_compile_definitions(openssl_ed25519
PRIVATE
- -DOPENSSL_ED25519_EXPORT
+ OPENSSL_ED25519_EXPORT
)
target_link_libraries(openssl_ed25519
diff --git a/dep/protobuf/CMakeLists.txt b/dep/protobuf/CMakeLists.txt
index c1c29ce6578..c1465b73c7f 100644
--- a/dep/protobuf/CMakeLists.txt
+++ b/dep/protobuf/CMakeLists.txt
@@ -74,10 +74,10 @@ target_link_libraries(protobuf
if (BUILD_SHARED_LIBS)
target_compile_definitions(protobuf
PRIVATE
- -DLIBPROTOBUF_EXPORTS
- -DLIBPROTOC_EXPORTS
+ LIBPROTOBUF_EXPORTS
+ LIBPROTOC_EXPORTS
PUBLIC
- -DPROTOBUF_USE_DLLS)
+ PROTOBUF_USE_DLLS)
endif()
if (MSVC)
@@ -87,7 +87,7 @@ if (MSVC)
target_compile_definitions(protobuf
PRIVATE
- -D_SCL_SECURE_NO_WARNINGS)
+ _SCL_SECURE_NO_WARNINGS)
endif()
set_target_properties(protobuf
diff --git a/dep/rapidjson/CMakeLists.txt b/dep/rapidjson/CMakeLists.txt
index 58c4d48f09a..6ec34b9b083 100644
--- a/dep/rapidjson/CMakeLists.txt
+++ b/dep/rapidjson/CMakeLists.txt
@@ -16,9 +16,9 @@ target_include_directories(rapidjson
target_compile_definitions(rapidjson
INTERFACE
- -DRAPIDJSON_HAS_STDSTRING
- -DRAPIDJSON_48BITPOINTER_OPTIMIZATION=0
- -DRAPIDJSON_ASSERT=WPAssert)
+ RAPIDJSON_HAS_STDSTRING
+ RAPIDJSON_48BITPOINTER_OPTIMIZATION=0
+ RAPIDJSON_ASSERT=WPAssert)
if(TRINITY_SYSTEM_PROCESSOR MATCHES "x86|amd64")
target_compile_definitions(rapidjson INTERFACE -DRAPIDJSON_SSE2)
diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt
index 66caf6c4e10..ba27ddee3e2 100644
--- a/src/common/CMakeLists.txt
+++ b/src/common/CMakeLists.txt
@@ -29,21 +29,10 @@ endif(USE_COREPCH)
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_COMMON)
-
add_library(common
${PRIVATE_SOURCES}
)
-# Do NOT add any extra include directory here, as we don't want the common
-# library to depend on anything else than TC deps, and itself.
-# This way we ensure that if either a PR does that without modifying this file,
-# a compile error will be generated, either this file will be modified so it
-# is detected more easily.
-# While it is OK to include files from other libs as long as they don't require
-# linkage (enums, defines...) it is discouraged to do so unless necessary, as it will pullute
-# include_directories leading to further unnoticed dependency aditions
-# Linker Depencency requirements: none
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -58,6 +47,10 @@ target_include_directories(common
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(common
+ PRIVATE
+ TRINITY_API_EXPORT_COMMON)
+
target_link_libraries(common
PRIVATE
trinity-core-interface
diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt
index bc1d6c2d233..235ad973a40 100644
--- a/src/server/CMakeLists.txt
+++ b/src/server/CMakeLists.txt
@@ -8,14 +8,6 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-# Enforce compileparameters for corebuilds under GCC
-# This to stop a few silly crashes that could have been avoided IF people
-# weren't doing some -O3 psychooptimizations etc.
-
-if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW)
- add_definitions(-fno-delete-null-pointer-checks)
-endif()
-
if(WIN32)
list(APPEND sources_windows
${CMAKE_SOURCE_DIR}/src/common/Platform/ServiceWin32.cpp
diff --git a/src/server/database/CMakeLists.txt b/src/server/database/CMakeLists.txt
index b652e7f3ffc..8c9788c34cd 100644
--- a/src/server/database/CMakeLists.txt
+++ b/src/server/database/CMakeLists.txt
@@ -24,15 +24,6 @@ add_library(database
${PRIVATE_SOURCES}
)
-# Do NOT add any extra include directory unless it does not create unneeded extra dependencies,
-# and specially, not add any dependency to neither of these: shared, game, scripts
-# This way we ensure that if either a PR does that without modifying this file,
-# a compile error will be generated, either this file will be modified so it
-# is detected more easily.
-# While it is OK to include files from other libs as long as they don't require
-# linkage (enums, defines...) it is discouraged to do so unless necessary, as it will pullute
-# include_directories leading to further unnoticed dependency aditions
-# Linker Depencency requirements: common
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -45,7 +36,9 @@ target_include_directories(database
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
-add_definitions(-DTRINITY_API_EXPORT_DATABASE)
+target_compile_definitions(database
+ PRIVATE
+ TRINITY_API_EXPORT_DATABASE)
target_link_libraries(database
PRIVATE
diff --git a/src/server/game/CMakeLists.txt b/src/server/game/CMakeLists.txt
index 53971feebfe..db6e4fc5caf 100644
--- a/src/server/game/CMakeLists.txt
+++ b/src/server/game/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_GAME)
-
CollectIncludeDirectories(
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC_INCLUDES
@@ -48,6 +46,10 @@ target_include_directories(game
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(game
+ PRIVATE
+ TRINITY_API_EXPORT_GAME)
+
target_link_libraries(game
PRIVATE
trinity-core-interface
diff --git a/src/server/proto/CMakeLists.txt b/src/server/proto/CMakeLists.txt
index 7d9172a1abc..97844c7fb43 100644
--- a/src/server/proto/CMakeLists.txt
+++ b/src/server/proto/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_PROTO)
-
add_library(proto
${PRIVATE_SOURCES}
)
@@ -40,6 +38,10 @@ target_include_directories(proto
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(proto
+ PRIVATE
+ TRINITY_API_EXPORT_PROTO)
+
target_link_libraries(proto
PRIVATE
trinity-default-interface
diff --git a/src/server/shared/CMakeLists.txt b/src/server/shared/CMakeLists.txt
index 040381b946f..7b6a54fe0ae 100644
--- a/src/server/shared/CMakeLists.txt
+++ b/src/server/shared/CMakeLists.txt
@@ -20,8 +20,6 @@ endif()
GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_definitions(-DTRINITY_API_EXPORT_SHARED)
-
add_library(shared
${PRIVATE_SOURCES}
)
@@ -38,6 +36,10 @@ target_include_directories(shared
PRIVATE
${CMAKE_CURRENT_BINARY_DIR})
+target_compile_definitions(shared
+ PRIVATE
+ TRINITY_API_EXPORT_SHARED)
+
target_link_libraries(shared
PRIVATE
trinity-core-interface
diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt
index 0820b3b020f..1b85fefd128 100644
--- a/src/server/worldserver/CMakeLists.txt
+++ b/src/server/worldserver/CMakeLists.txt
@@ -39,12 +39,6 @@ if(NOT WIN32)
)
endif()
-if(UNIX AND NOT NOJEM AND NOT APPLE)
- set(worldserver_LINK_FLAGS "-pthread -lncurses ${worldserver_LINK_FLAGS}")
-endif()
-
-set_target_properties(worldserver PROPERTIES LINK_FLAGS "${worldserver_LINK_FLAGS}")
-
target_link_libraries(worldserver
PRIVATE
trinity-core-interface