aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Tari <robert@tari.in>2022-02-11 14:06:49 +0100
committerRobert Tari <robert@tari.in>2022-02-11 14:06:49 +0100
commite6b34ef4daa0809c7bfd5cbffc7cbcc1d053345b (patch)
treeefe674547e63cbf829b51eef92d6c4d1644d426d
parent3bec2d1519b31791d0c098e4ab2d6ae9d693ab53 (diff)
downloadlibayatana-appindicator-e6b34ef4daa0809c7bfd5cbffc7cbcc1d053345b.tar.gz
libayatana-appindicator-e6b34ef4daa0809c7bfd5cbffc7cbcc1d053345b.tar.bz2
libayatana-appindicator-e6b34ef4daa0809c7bfd5cbffc7cbcc1d053345b.zip
Clean up compilation flags
-rw-r--r--CMakeLists.txt31
-rw-r--r--bindings/vala/examples/CMakeLists.txt2
-rw-r--r--example/CMakeLists.txt3
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--tests/CMakeLists.txt9
5 files changed, 14 insertions, 32 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4ee060c..e6bed2a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.13)
project(libayatana-appindicator C)
+set(PROJECT_VERSION "0.5.90")
+set(PROJECT_NAME "libayatana-appindicator")
+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "..." FORCE)
endif(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
@@ -24,8 +27,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
@@ -62,6 +70,7 @@ if(ENABLE_TESTS)
set(DEPS ${DEPS} dbus-1>=1.12 dbus-glib-1>=0.82)
endif()
+include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
pkg_check_modules(PROJECT_DEPS REQUIRED ${DEPS})
@@ -73,24 +82,6 @@ if (ENABLE_GTKDOC)
endif()
endif()
-# Set global variables
-
-include(GNUInstallDirs)
-set(PROJECT_VERSION "0.5.90")
-set(PROJECT_NAME "libayatana-appindicator")
-
-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/bindings/vala/examples/CMakeLists.txt b/bindings/vala/examples/CMakeLists.txt
index f393939..b747208 100644
--- a/bindings/vala/examples/CMakeLists.txt
+++ b/bindings/vala/examples/CMakeLists.txt
@@ -21,7 +21,7 @@ add_custom_command(
# ayatana-indicator-example
-set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
+set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
add_executable("ayatana-indicator-example" "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-example.c")
target_include_directories("ayatana-indicator-example" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_link_libraries("ayatana-indicator-example" "${PROJECT_DEPS_LIBRARIES} -layatana-appindicator3 -L${CMAKE_BINARY_DIR}/src")
diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt
index 3a6cd53..a337cdc 100644
--- a/example/CMakeLists.txt
+++ b/example/CMakeLists.txt
@@ -31,7 +31,7 @@ if (FLAVOUR_GTK3)
# simple-client-vala
- set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
+ set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
add_executable("simple-client-vala" "${CMAKE_CURRENT_BINARY_DIR}/simple-client-vala.c")
target_include_directories("simple-client-vala" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_link_libraries("simple-client-vala" "${PROJECT_DEPS_LIBRARIES} -l${ayatana_appindicator_gtkver} -L${CMAKE_BINARY_DIR}/src")
@@ -41,7 +41,6 @@ endif()
# simple-client
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/simple-client.c" PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_executable("simple-client" "${CMAKE_CURRENT_SOURCE_DIR}/simple-client.c")
target_compile_definitions("simple-client" PUBLIC LOCAL_ICON="${CMAKE_CURRENT_SOURCE_DIR}/simple-client-test-icon.png")
target_include_directories("simple-client" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 1d23671..b6ba839 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -118,7 +118,6 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/gen-notification-watcher.xml.c" ${GEN_NO
# libayatana-appindicator{,3}.so
-set_source_files_properties(${SOURCES} PROPERTIES COMPILE_FLAGS ${COMPILE_FLAGS})
add_library("${ayatana_appindicator_gtkver}" SHARED ${SOURCES})
set_target_properties("${ayatana_appindicator_gtkver}" PROPERTIES VERSION 1.0.0 SOVERSION 1)
target_compile_definitions("${ayatana_appindicator_gtkver}" PUBLIC G_LOG_DOMAIN="libayatana-appindicator")
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 3ee3650..6a482d8 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -6,7 +6,7 @@ endif()
# test-libappindicator
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
+set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator.c" PROPERTIES COMPILE_FLAGS " -include ${CMAKE_SOURCE_DIR}/src/app-indicator.h")
add_executable("test-libappindicator" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator.c")
target_compile_definitions("test-libappindicator" PUBLIC SRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
target_include_directories("test-libappindicator" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
@@ -17,7 +17,6 @@ add_dependencies("test-libappindicator" "${ayatana_appindicator_gtkver}")
# test-libappindicator-dbus-client
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-dbus-client" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-dbus-client.c")
target_include_directories("test-libappindicator-dbus-client" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("test-libappindicator-dbus-client" PUBLIC "${CMAKE_SOURCE_DIR}/src")
@@ -27,7 +26,6 @@ add_dependencies("test-libappindicator-dbus-client" "${ayatana_appindicator_gtkv
# test-libappindicator-dbus-server
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-dbus-server.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-dbus-server" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-dbus-server.c")
target_include_directories("test-libappindicator-dbus-server" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("test-libappindicator-dbus-server" PUBLIC "${CMAKE_SOURCE_DIR}/src")
@@ -37,7 +35,6 @@ add_dependencies("test-libappindicator-dbus-server" "${ayatana_appindicator_gtkv
# test-libappindicator-status-client
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-status-client.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-status-client" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-status-client.c")
target_include_directories("test-libappindicator-status-client" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_link_libraries("test-libappindicator-status-client" "${PROJECT_DEPS_LIBRARIES} -l${ayatana_appindicator_gtkver}")
@@ -46,7 +43,6 @@ add_dependencies("test-libappindicator-status-client" "${ayatana_appindicator_gt
# test-libappindicator-status-server
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-status-server.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-status-server" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-status-server.c")
target_include_directories("test-libappindicator-status-server" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("test-libappindicator-status-server" PUBLIC "${CMAKE_SOURCE_DIR}/src")
@@ -56,7 +52,6 @@ add_dependencies("test-libappindicator-status-server" "${ayatana_appindicator_gt
# test-libappindicator-fallback-item
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-fallback-item.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-fallback-item" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-fallback-item.c")
target_include_directories("test-libappindicator-fallback-item" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("test-libappindicator-fallback-item" PUBLIC "${CMAKE_SOURCE_DIR}/src")
@@ -66,7 +61,6 @@ add_dependencies("test-libappindicator-fallback-item" "${ayatana_appindicator_gt
# test-libappindicator-fallback-watcher
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-fallback-watcher.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-libappindicator-fallback-watcher" "${CMAKE_CURRENT_SOURCE_DIR}/test-libappindicator-fallback-watcher.c")
target_include_directories("test-libappindicator-fallback-watcher" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_link_libraries("test-libappindicator-fallback-watcher" "${PROJECT_DEPS_LIBRARIES} -l${ayatana_appindicator_gtkver}")
@@ -75,7 +69,6 @@ add_dependencies("test-libappindicator-fallback-watcher" "${ayatana_appindicator
# test-simple-app
-set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/test-simple-app.c" PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS}")
add_executable("test-simple-app" "${CMAKE_CURRENT_SOURCE_DIR}/test-simple-app.c")
target_include_directories("test-simple-app" PUBLIC ${PROJECT_DEPS_INCLUDE_DIRS})
target_include_directories("test-simple-app" PUBLIC "${CMAKE_SOURCE_DIR}/src")