diff options
Diffstat (limited to 'cmake/compiler/clang/settings.cmake')
-rw-r--r-- | cmake/compiler/clang/settings.cmake | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/cmake/compiler/clang/settings.cmake b/cmake/compiler/clang/settings.cmake index 1cd95bbf703..204cc6d245a 100644 --- a/cmake/compiler/clang/settings.cmake +++ b/cmake/compiler/clang/settings.cmake @@ -1,29 +1,48 @@ # 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(WITH_WARNINGS) - set(WARNING_FLAGS "-W -Wall -Wextra -Winit-self -Wfatal-errors -Wno-mismatched-tags") - 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 + -Wfatal-errors + -Wno-mismatched-tags + -Woverloaded-virtual) + message(STATUS "Clang: 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 "Clang: Debug-flags set (-g3)") endif() # -Wno-narrowing needed to suppress a warning in g3d # -Wno-deprecated-register is needed to suppress 185 gsoap warnings on Unix systems. -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wno-narrowing -Wno-deprecated-register") -set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG=1") +target_compile_options(trinity-compile-option-interface + INTERFACE + -Wno-narrowing + -Wno-deprecated-register) + +target_compile_definitions(trinity-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. - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -fvisibility=hidden") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -fvisibility=hidden") + target_compile_options(trinity-compile-option-interface + INTERFACE + -fPIC + -fvisibility=hidden) # --no-undefined to throw errors when there are undefined symbols # (caused through missing TRINITY_*_API macros). |