aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Kerr <charles.kerr@canonical.com>2016-03-11 14:06:34 -0600
committerCharles Kerr <charles.kerr@canonical.com>2016-03-11 14:06:34 -0600
commit0734731e7296f84ab30ac403886635b7cb89da49 (patch)
tree2ce36bf6cd59e8e2e5165a8be59e0c0ab7222f7b
parentd8ef8e68805ab7f53258427c79ee5aaafec916ba (diff)
downloadayatana-indicator-display-0734731e7296f84ab30ac403886635b7cb89da49.tar.gz
ayatana-indicator-display-0734731e7296f84ab30ac403886635b7cb89da49.tar.bz2
ayatana-indicator-display-0734731e7296f84ab30ac403886635b7cb89da49.zip
clean up compile_options and warnings. Add DBUS debug log messages to ctest environment variables.
-rw-r--r--CMakeLists.txt25
-rw-r--r--src/CMakeLists.txt5
-rw-r--r--tests/CMakeLists.txt9
-rw-r--r--tests/integration/CMakeLists.txt2
4 files changed, 25 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5110c9e..3230a2b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ option(enable_lcov "Generate lcov code coverage reports." ON)
##
## GNU standard paths
##
+
include(GNUInstallDirs)
if(EXISTS "/etc/debian_version") # Workaround for libexecdir on debian
set(CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}")
@@ -35,32 +36,34 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
+set(GLIB_MINIMUM 2.36)
pkg_check_modules(SERVICE_DEPS REQUIRED
- gio-unix-2.0>=2.36
- glib-2.0>=2.36
+ gio-unix-2.0>=${GLIB_MINIMUM}
+ glib-2.0>=${GLIB_MINIMUM}
)
include_directories (SYSTEM
${SERVICE_DEPS_INCLUDE_DIRS}
)
##
-##
+## Compiler settings
##
-set (CMAKE_INCLUDE_CURRENT_DIR OFF)
-include_directories (${CMAKE_CURRENT_SOURCE_DIR})
+include_directories(${CMAKE_CURRENT_SOURCE_DIR})
# set the compiler warnings
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set(CXX_WARNING_ARGS "${CXX_WARNING_ARGS} -Weverything -Wno-c++98-compat -Wno-padded")
-else()
- set(CXX_WARNING_ARGS "${CXX_WARNING_ARGS} -Wall -Wextra -Wpedantic")
+ list(APPEND CXX_WARNING_ARGS -Weverything -Wno-c++98-compat -Wno-padded)
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
+ list(APPEND CXX_WARNING_ARGS -Wall -Wextra -Wpedantic)
endif()
-set(CXX_WARNING_ARGS "${CXX_WARNING_ARGS} -Wno-missing-field-initializers") # GActionEntry
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14 -fPIC -g")
+add_compile_options(-std=c++14 -fPIC -g)
+
+##
+## Testing & Coverage
+##
-# testing & coverage
if(${enable_tests})
enable_testing()
if(${enable_lcov})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index d0ab901..02d973e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,7 +1,10 @@
add_definitions(-DG_LOG_DOMAIN="${CMAKE_PROJECT_NAME}")
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_ARGS} ${GCOV_FLAGS}")
+add_compile_options(
+ ${CXX_WARNING_ARGS}
+ ${GCOV_FLAGS}
+)
add_library(
${SERVICE_LIB}
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index be0000d..7be2acd 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -16,14 +16,17 @@ include_directories(SYSTEM
${GMOCK_INCLUDE_DIRS}
)
-set(CTEST_ENVIRONMENT "${CTEST_ENVIRONMENT};G_MESSAGES_DEBUG=all")
+list(APPEND CTEST_ENVIRONMENT
+ G_MESSAGES_DEBUG=all
+ G_DBUS_DEBUG=call,signal,return,message
+)
# turn off the warnings that break Google Test
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
- set(CXX_WARNING_ARGS "${CXX_WARNING_ARGS} -Wno-global-constructors -Wno-weak-vtables")
+ list(APPEND CXX_WARNING_ARGS -Wno-global-constructors -Wno-weak-vtables)
endif()
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_WARNING_ARGS}")
+add_compile_options(${CXX_WARNING_ARGS})
add_test(cppcheck cppcheck --enable=all -USCHEMA_DIR --error-exitcode=2 --inline-suppr -I${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/tests)
diff --git a/tests/integration/CMakeLists.txt b/tests/integration/CMakeLists.txt
index c04ecc8..1eb7b3e 100644
--- a/tests/integration/CMakeLists.txt
+++ b/tests/integration/CMakeLists.txt
@@ -18,7 +18,7 @@ function(add_qt_test_by_name name)
set(TEST_NAME ${name})
add_executable (${TEST_NAME} ${TEST_NAME}.cpp)
add_test(${TEST_NAME} ${TEST_NAME})
- set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT "${CTEST_ENVIRONMENT}")
+ set_property(TEST ${TEST_NAME} APPEND PROPERTY ENVIRONMENT ${CTEST_ENVIRONMENT})
target_link_libraries(${TEST_NAME} ${SERVICE_LINK_LIBRARIES} ${QT_LINK_LIBRARIES} ${TEST_LINK_LIBRARIES})
endfunction()
add_qt_test_by_name(usb-manager-test)