aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-27 15:10:13 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-27 15:10:13 +0100
commit83aa7c3d21e4df4613488892b0f917f3932034cb (patch)
tree4373547626af614e2cc25dbdeabd094a188ce57f
parent69eac3c0291049a76988d076b43c599230473731 (diff)
parenta2743f912739533299d1ceafb55f6ed9fd74d9b5 (diff)
downloadayatana-indicator-messages-83aa7c3d21e4df4613488892b0f917f3932034cb.tar.gz
ayatana-indicator-messages-83aa7c3d21e4df4613488892b0f917f3932034cb.tar.bz2
ayatana-indicator-messages-83aa7c3d21e4df4613488892b0f917f3932034cb.zip
Merge branch 'tari01-pr/cleanup-compile-flags'
Attributes GH PR #28: https://github.com/AyatanaIndicators/ayatana-indicator-messages/pull/28
-rw-r--r--.build.yml8
-rw-r--r--CMakeLists.txt17
-rw-r--r--libmessaging-menu/CMakeLists.txt1
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--tests/CMakeLists.txt14
5 files changed, 20 insertions, 21 deletions
diff --git a/.build.yml b/.build.yml
index e53999b..834eac9 100644
--- a/.build.yml
+++ b/.build.yml
@@ -95,15 +95,17 @@ before_scripts:
build_scripts:
- if [ ${DISTRO_NAME} == "debian" ];then
- - export CFLAGS+=" -Wsign-compare -Wunused-parameter"
- cppcheck --enable=warning,style,performance,portability,information,missingInclude .
- fi
-
- if [ -e ./CMakeLists.txt ]; then
- - if [ ${DISTRO_NAME} == "debian" ] || [ ${DISTRO_NAME} == "ubuntu" ]; then
+ - if [ ${DISTRO_NAME} == "debian" ]; then
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON -DENABLE_TESTS=ON
+ - elif [ ${DISTRO_NAME} == "ubuntu" ]; then
+ # Ubuntu has an old GTest which throws warnings, so we cannot use -Werror here
- scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON
- else
- - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON
- fi
- else
- exit 1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8dbc9ee..239b05c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,14 +12,6 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
-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()
-
# Options
option(ENABLE_TESTS "Enable all tests and checks" OFF)
@@ -34,8 +26,13 @@ else()
endif()
if(ENABLE_WERROR)
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
+ add_definitions("-Werror")
+endif()
+
+if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ add_definitions("-Weverything")
+else()
+ add_definitions("-Wall")
endif()
# Check for prerequisites
diff --git a/libmessaging-menu/CMakeLists.txt b/libmessaging-menu/CMakeLists.txt
index 53204ec..31121a6 100644
--- a/libmessaging-menu/CMakeLists.txt
+++ b/libmessaging-menu/CMakeLists.txt
@@ -26,7 +26,6 @@ set(
)
set_source_files_properties(${SOURCES_GEN} PROPERTIES GENERATED TRUE)
-set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("messaging-menu" SHARED ${SOURCES} ${SOURCES_GEN})
set_target_properties("messaging-menu" PROPERTIES VERSION 0.0.0 SOVERSION 0)
target_include_directories("messaging-menu" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} "${CMAKE_BINARY_DIR}/src")
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 4c8ace8..04479e1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,7 +36,6 @@ set(
messages-service.c
)
-set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_executable("ayatana-indicator-messages-service" ${SOURCES} ${SOURCES_GEN})
target_compile_definitions(
"ayatana-indicator-messages-service" PUBLIC
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 1f0d117..a43265d 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -24,7 +24,6 @@ set(
)
set_source_files_properties(${HEADERS_GEN} ${SOURCES_GEN} PROPERTIES GENERATED TRUE)
-set_source_files_properties(${HEADERS} ${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("indicator-messages-service" STATIC ${HEADERS} ${HEADERS_GEN} ${SOURCES} ${SOURCES_GEN})
target_include_directories("indicator-messages-service" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_compile_definitions("indicator-messages-service" PUBLIC G_LOG_DOMAIN="Ayatana-Indicator-Messages")
@@ -32,18 +31,22 @@ target_link_libraries("indicator-messages-service")
# test-gactionmuxer
-set_source_files_properties(gtest-menuitems.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_executable("test-gactionmuxer" test-gactionmuxer.cpp)
target_link_options("test-gactionmuxer" PRIVATE -no-pie)
target_include_directories("test-gactionmuxer" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/src")
target_link_libraries("test-gactionmuxer" "indicator-messages-service" ${PROJECT_DEPS_LIBRARIES} ${GTEST_LIBRARIES} ${GTEST_BOTH_LIBRARIES} ${GMOCK_LIBRARIES})
-if (ENABLE_COVERAGE)
- target_link_libraries("test-gactionmuxer" "-lgcov")
-endif()
add_test("test-gactionmuxer" "test-gactionmuxer")
add_dependencies("test-gactionmuxer" "indicator-messages-service")
set(COVERAGE_TEST_TARGETS ${COVERAGE_TEST_TARGETS} "test-gactionmuxer" PARENT_SCOPE)
+if (ENABLE_COVERAGE)
+ if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
+ target_link_libraries("test-gactionmuxer" "--coverage")
+ else()
+ target_link_libraries("test-gactionmuxer" "-lgcov")
+ endif()
+endif()
+
# gschemas.compiled
set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)
@@ -55,7 +58,6 @@ add_custom_target("gschemas-compiled" ALL DEPENDS gschemas.compiled)
# indicator-test
pkg_check_modules(DBUSTEST REQUIRED dbustest-1)
-set_source_files_properties(indicator-test.cpp PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_executable("indicator-test" indicator-test.cpp)
target_link_options("indicator-test" PRIVATE -no-pie)
target_include_directories("indicator-test" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS} ${DBUSTEST_INCLUDE_DIRS} "${CMAKE_SOURCE_DIR}/libmessaging-menu")