diff options
Diffstat (limited to 'cmake/compiler/gcc/settings.cmake')
-rw-r--r-- | cmake/compiler/gcc/settings.cmake | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index b9d2e457df8..d854ff521ce 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -1,5 +1,7 @@ # Set build-directive (used in core to tell which buildtype we used) -add_definitions(-D_BUILD_DIRECTIVE='"${CMAKE_BUILD_TYPE}"') +target_compile_definitions(trinity-compile-option-interface + INTERFACE + -D_BUILD_DIRECTIVE="${CMAKE_BUILD_TYPE}") set(GCC_EXPECTED_VERSION 6.3.0) @@ -7,37 +9,47 @@ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_EXPECTED_VERSION) message(FATAL_ERROR "GCC: TrinityCore requires version ${GCC_EXPECTED_VERSION} to build but found ${CMAKE_CXX_COMPILER_VERSION}") endif() -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -message(STATUS "GCC: Enabled c++11 support") - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99") -message(STATUS "GCC: Enabled C99 support") - if(PLATFORM EQUAL 32) # Required on 32-bit systems to enable SSE2 (standard on x64) - set(SSE_FLAGS "-msse2 -mfpmath=sse") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SSE_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SSE_FLAGS}") + target_compile_options(trinity-compile-option-interface + INTERFACE + -msse2 + -mfpmath=sse) endif() -add_definitions(-DHAVE_SSE2 -D__SSE2__) +target_compile_definitions(trinity-compile-option-interface + INTERFACE + -DHAVE_SSE2 + -D__SSE2__) message(STATUS "GCC: SFMT enabled, SSE2 flags forced") if( WITH_WARNINGS ) - set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Winvalid-pch -Wfatal-errors") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} -Woverloaded-virtual") + target_compile_options(trinity-warning-interface + INTERFACE + -W + -Wall + -Wextra + -Winit-self + -Winvalid-pch + -Wfatal-errors + -Woverloaded-virtual) + message(STATUS "GCC: All warnings enabled") endif() if( WITH_COREDEBUG ) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g3") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g3") + target_compile_options(trinity-compile-option-interface + INTERFACE + -g3) + message(STATUS "GCC: Debug-flags set (-g3)") endif() if (BUILD_SHARED_LIBS) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden -Wno-attributes") + target_compile_options(trinity-compile-option-interface + INTERFACE + -fPIC + -fvisibility=hidden + -Wno-attributes) # Should break the build when there are TRINITY_*_API macros missing # but it complains about missing references in precompiled headers. |