diff options
author | Charles Kerr <charles.kerr@canonical.com> | 2013-07-01 21:00:17 -0500 |
---|---|---|
committer | Charles Kerr <charles.kerr@canonical.com> | 2013-07-01 21:00:17 -0500 |
commit | e875abf22fc02939185b6aa881865cff58fc1543 (patch) | |
tree | 69bd5d76cc20bb0556f751a32a4472de22a81bd1 | |
parent | cba24317a60a2670c0c917aaa637488b834da379 (diff) | |
download | ayatana-indicator-session-e875abf22fc02939185b6aa881865cff58fc1543.tar.gz ayatana-indicator-session-e875abf22fc02939185b6aa881865cff58fc1543.tar.bz2 ayatana-indicator-session-e875abf22fc02939185b6aa881865cff58fc1543.zip |
in cmake files, limit scopes by moving single-target properties out of the global variables to single-target ones and moving single-use includes into the directories where they're used
-rw-r--r-- | CMakeLists.txt | 30 | ||||
-rw-r--r-- | data/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 11 | ||||
-rw-r--r-- | src/backend-dbus/CMakeLists.txt | 2 |
4 files changed, 27 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c8dc83e..f8a366b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,15 +10,23 @@ set (GETTEXT_PACKAGE ${CMAKE_PROJECT_NAME}) option (enable_tests "Build the package's automatic tests." ON) option (enable_lcov "Generate lcov code coverage reports." ON) -find_package(PkgConfig REQUIRED) +## +## GNU standard installation directories +## include (GNUInstallDirs) -include (FindPkgConfig) -include (GdbusCodegen) -include (UseGSettings) +if (EXISTS "/etc/debian_version") # Workaround for libexecdir on debian + set (CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}") + set (CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBDIR}") +endif () +set (CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") +set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") -add_definitions( -DGETTEXT_PACKAGE="${GETTEXT_PACKAGE}" ) -add_definitions (-DGNOMELOCALEDIR=\"@CMAKE_INSTALL_PREFIX@/share/locale\") +## +## Check for prerequisites +## +find_package (PkgConfig REQUIRED) +include (FindPkgConfig) pkg_check_modules (SERVICE REQUIRED glib-2.0>=2.36 gio-unix-2.0>=2.36) @@ -26,8 +34,6 @@ include_directories (${SERVICE_INCLUDE_DIRS}) set (CC_WARNING_ARGS " -Wall -pedantic -Wextra -Wno-missing-field-initializers") - - set (ARCHIVE_NAME ${CMAKE_PROJECT_NAME}-${PROJECT_VERSION}) add_custom_target (dist COMMAND bzr export --root=${ARCHIVE_NAME} ${CMAKE_BINARY_DIR}/${ARCHIVE_NAME}.tar.gz @@ -43,14 +49,6 @@ add_custom_target (cppcheck COMMAND cppcheck --enable=all -q --error-exitcode=2 include_directories (${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories (${CMAKE_CURRENT_BINARY_DIR}/src) -# Workaround for libexecdir on debian -if (EXISTS "/etc/debian_version") - set (CMAKE_INSTALL_LIBEXECDIR "${CMAKE_INSTALL_LIBDIR}") - set (CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBDIR}") -endif () - -set (CMAKE_INSTALL_PKGLIBEXECDIR "${CMAKE_INSTALL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") -set (CMAKE_INSTALL_FULL_PKGLIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/${CMAKE_PROJECT_NAME}") add_subdirectory (src) add_subdirectory (data) diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 3aa8ce4..ac4e76c 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -1,3 +1,5 @@ +include (UseGSettings) + ## ## GSettings schema ## diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index b327820..a00b6f1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,12 +9,19 @@ add_library (libindicatorsessionservice STATIC service.h users.c users.h) -set_target_properties (libindicatorsessionservice PROPERTIES COMPILE_FLAGS " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") - include_directories(${SERVICE_INCLUDE_DIRS}) link_directories(${SERVICE_LIBRARY_DIRS}) set (SERVICE_EXEC "indicator-session-service") +set_property (SOURCE main.c + APPEND PROPERTY COMPILE_DEFINITIONS + GETTEXT_PACKAGE="${GETTEXT_PACKAGE}" + GNOMELOCALEDIR="@CMAKE_INSTALL_FULL_LOCALEDIR@") add_executable (${SERVICE_EXEC} main.c) target_link_libraries (${SERVICE_EXEC} libindicatorsessionservice backenddbus ${SERVICE_LIBRARIES} ${GCOV_LIBS}) install (TARGETS ${SERVICE_EXEC} RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}) + +# common properties +set_property (TARGET libindicatorsessionservice ${SERVICE_EXEC} + APPEND_STRING PROPERTY COMPILE_FLAGS + " -g ${CC_WARNING_ARGS} ${GCOV_FLAGS}") diff --git a/src/backend-dbus/CMakeLists.txt b/src/backend-dbus/CMakeLists.txt index 1c0df8e..fa41534 100644 --- a/src/backend-dbus/CMakeLists.txt +++ b/src/backend-dbus/CMakeLists.txt @@ -1,3 +1,5 @@ +include (GdbusCodegen) + set(BACKEND_GENERATED_SOURCES ) |