aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-27 10:07:53 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2022-01-27 10:07:53 +0100
commitd70bd10f47f92928b3a918a82cdab230ffb1a5b0 (patch)
treece058cc598058adcfba7c68526eac30e106535cd
parenteeb9ddc6a66cd84d89141866d629800f729d9883 (diff)
parent6cf760460cfa3bdc126e8a6699e654f36d314205 (diff)
downloadayatana-indicator-power-d70bd10f47f92928b3a918a82cdab230ffb1a5b0.tar.gz
ayatana-indicator-power-d70bd10f47f92928b3a918a82cdab230ffb1a5b0.tar.bz2
ayatana-indicator-power-d70bd10f47f92928b3a918a82cdab230ffb1a5b0.zip
Merge branch 'tari01-pr/cleanup-compile-flags'
Attributes GH PR #55: https://github.com/AyatanaIndicators/ayatana-indicator-power/pull/55
-rw-r--r--.build.yml5
-rw-r--r--CMakeLists.txt26
-rw-r--r--src/CMakeLists.txt9
-rw-r--r--tests/CMakeLists.txt3
4 files changed, 11 insertions, 32 deletions
diff --git a/.build.yml b/.build.yml
index 88c9e78..955779a 100644
--- a/.build.yml
+++ b/.build.yml
@@ -126,15 +126,14 @@ 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
- - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_TESTS=ON
+ - scan-build $CHECKERS cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=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 1de415a..2bdab9d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,10 +23,17 @@ 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()
+
+add_definitions("-Wno-sign-compare") # Needed for GTest on Ubuntu
+
##
## GNU standard installation directories
##
@@ -87,20 +94,6 @@ add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2
${CMAKE_SOURCE_DIR}/src
${CMAKE_SOURCE_DIR}/tests)
-##
-## Actual building
-##
-
-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set(C_WARNING_ARGS "${C_WARNING_ARGS} -Weverything")
- set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-c++98-compat -Wno-padded") # these are annoying
- set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-documentation") # gtk-doc != doxygen
-else()
- set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wall -Wformat=2") # Use -Wextra and -Wpedantic explicitly if needed
-endif()
-set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-missing-field-initializers") # GActionEntry
-
-
include_directories (${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories (${CMAKE_CURRENT_BINARY_DIR}/include)
@@ -109,7 +102,6 @@ add_subdirectory(src)
add_subdirectory(data)
add_subdirectory(po)
-
# testing & coverage
if (ENABLE_TESTS)
enable_testing ()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 38d3308..12fa6bb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -38,14 +38,6 @@ endif()
# add the bin dir to our include path so the code can find the generated header files
include_directories(${CMAKE_CURRENT_BINARY_DIR})
-
-# add warnings/coverage info on handwritten files
-# but not the autogenerated ones...
-set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-bad-function-cast") # g_clear_object()
-set(C_WARNING_ARGS "${C_WARNING_ARGS} -Wno-switch-enum")
-set_source_files_properties(${SERVICE_MANUAL_SOURCES}
- PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} -std=c99")
-
# the service library for tests to link against (basically, everything except main())
add_library(${SERVICE_LIB} STATIC ${SERVICE_MANUAL_SOURCES} ${SERVICE_GENERATED_SOURCES})
include_directories(${CMAKE_SOURCE_DIR})
@@ -53,6 +45,5 @@ link_directories(${SERVICE_DEPS_LIBRARY_DIRS})
# the executable: lib + main()
add_executable (${SERVICE_EXEC} main.c)
-set_source_files_properties(${SERVICE_SOURCES} main.c PROPERTIES COMPILE_FLAGS "${C_WARNING_ARGS} -std=c99")
target_link_libraries (${SERVICE_EXEC} ${SERVICE_LIB} ${SERVICE_DEPS_LIBRARIES})
install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 714e9a7..05b3da0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,9 +6,6 @@ pkg_check_modules(DBUSTEST REQUIRED
dbustest-1>=14.04.0)
include_directories (SYSTEM ${DBUSTEST_INCLUDE_DIRS})
-# add warnings
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${C_WARNING_ARGS}")
-
# build the necessary schemas
set_directory_properties (PROPERTIES
ADDITIONAL_MAKE_CLEAN_FILES gschemas.compiled)