aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake')
-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
7 files changed, 54 insertions, 37 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()