diff options
| author | Naios <naios-dev@live.de> | 2017-10-31 01:29:51 +0100 |
|---|---|---|
| committer | Naios <naios-dev@live.de> | 2017-12-17 20:22:33 +0100 |
| commit | e60c1f84a7e13577a82046b02b214f9466d20a7c (patch) | |
| tree | 4413801132daff4fd180cd6569ffde230b5ba50b /cmake/compiler/mingw | |
| parent | 5a9ccae3e1115d6fb1dcc287b1cb2d45779fd39b (diff) | |
Build: Use interface targets for inheriting flags and definitions
* Remove the usage of global flags and definitions
set through the CMAKE_CXX_FLAGS variable.
* Use cmake target compile features for setting the
CXX standard automatically.
* Make C++14 globally available in the project
* Closes #21033
Diffstat (limited to 'cmake/compiler/mingw')
| -rw-r--r-- | cmake/compiler/mingw/settings.cmake | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/cmake/compiler/mingw/settings.cmake b/cmake/compiler/mingw/settings.cmake index 68156bd0b6b..e3c75581648 100644 --- a/cmake/compiler/mingw/settings.cmake +++ b/cmake/compiler/mingw/settings.cmake @@ -2,26 +2,41 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # 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}") 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() |
