From b6278e2421712b04892001f8cf866a09580f309e Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Fri, 14 Jan 2022 13:50:32 +0100 Subject: Clean up compilation flags --- CMakeLists.txt | 22 ++++++++++------------ example/CMakeLists.txt | 1 - src/CMakeLists.txt | 1 - tests/CMakeLists.txt | 2 -- 4 files changed, 10 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9f6cbff..81525a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,16 @@ else() set(CMAKE_BUILD_TYPE "Release") endif() +if(ENABLE_WERROR) + add_definitions("-Werror") +endif() + +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + add_definitions("-Weverything") +else() + add_definitions("-Wall") +endif() + # Check for prerequisites set(DEPS glib-2.0>=2.58 gtk+-3.0>=3.24) @@ -39,18 +49,6 @@ pkg_check_modules(PROJECT_DEPS REQUIRED ${DEPS}) include(GNUInstallDirs) set(PROJECT_VERSION "0.9.0") -if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - - set(COMPILE_FLAGS "${COMPILE_FLAGS} -Weverything") - set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-c++98-compat -Wno-padded") - set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wno-documentation") - -else() - - set(COMPILE_FLAGS "${COMPILE_FLAGS} -Wall") - -endif() - # Make everything add_subdirectory(src) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 52f7bde..95be390 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -1,6 +1,5 @@ # menus -set_source_files_properties(menus.c PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) add_executable("menus" menus.c) target_include_directories("menus" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS}) target_link_libraries("menus" ${PROJECT_DEPS_LIBRARIES} "-L${CMAKE_BINARY_DIR}/src" -layatana-ido3-0.4) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d0f023e..2f98b5d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -95,7 +95,6 @@ add_custom_command( # ayatana-ido3-0.4.so -set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) add_library("ayatana-ido3-0.4" SHARED ${SOURCES}) set_target_properties("ayatana-ido3-0.4" PROPERTIES VERSION 0.0.0 SOVERSION 0) target_link_libraries("ayatana-ido3-0.4" ${PROJECT_DEPS_LIBRARIES}) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index eb6cff1..74a258f 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -7,8 +7,6 @@ include_directories( ${PROJECT_DEPS_INCLUDE_DIRS} ) -set_source_files_properties(gtest-menuitems.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS}) - add_executable("gtest-menuitems" gtest-menuitems.cpp) target_link_options("gtest-menuitems" PRIVATE -no-pie) target_link_libraries("gtest-menuitems" -- cgit v1.2.3