From 828d75932a9a90cb9df9a69219c6040af823d082 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Wed, 16 Dec 2015 02:59:15 +0200 Subject: [PATCH] build system and modules cleanups Signed-off-by: Ivailo Monev --- cmake/modules/FindDBus.cmake | 118 +++++++------------------------- cmake/modules/FindEGL.cmake | 2 +- cmake/modules/FindMNG.cmake | 2 +- cmake/modules/FindNAS.cmake | 2 +- cmake/modules/FindSqlite.cmake | 2 +- cmake/modules/KatieMacros.cmake | 7 +- src/dbus/CMakeLists.txt | 4 +- 7 files changed, 31 insertions(+), 106 deletions(-) diff --git a/cmake/modules/FindDBus.cmake b/cmake/modules/FindDBus.cmake index c046ae3a8..de36ec3b7 100644 --- a/cmake/modules/FindDBus.cmake +++ b/cmake/modules/FindDBus.cmake @@ -1,111 +1,39 @@ -# FROM: https://gist.github.com/ajmontag/4043875 +# - Try to find D-Bus message bus system +# Once done this will define # -# - try to find the dbus library +# DBUS_FOUND - system has D-Bus message bus system +# DBUS_INCLUDES - the D-Bus message bus system include directory +# DBUS_LIBRARIES - The libraries needed to use D-Bus message bus system # -# Finddbus.cmake +# Copyright (c) 2015, Ivailo Monev, # -# Cache Variables: (probably not for direct use in CMakeLists.txt) -# DBUS_ROOT_DIR -# DBUS_LIBRARY -# DBUS_INCLUDE_DIR -# -# Non-cache variables you might use in your CMakeLists.txt: -# DBUS_FOUND -# -# DBUS_LIBRARIES -# DBUS_INCLUDE_DIRS -# -# Use this module this way: -# find_package(dbus) -# include_directories(DBUS_INCLUDE_DIRS) -# add_executable(myapp ${SOURCES}) -# target_link_libraries(myapp ${DBUS_LIBRARIES}) -# -# Requires these CMake modules: -# FindPackageHandleStandardArgs (CMake standard module) -# FindPkgConfig (CMake standard module) -# -# Dependencies: -# none -# -# BEGIN_DOT_FILE -# dbus [ label = "dbus" ]; -# END_DOT_FILE -# -# Author: -# Kevin M. Godby -# -# License: -# Boost 1.0 +# Redistribution and use is allowed according to the terms of the BSD license. -set(DBUS_ROOT_DIR - "${DBUS_ROOT_DIR}" - CACHE - PATH - "Prefix directory for libdbus") - -# Now let's find the dbus library -find_package(PkgConfig QUIET) -if(PKG_CONFIG_FOUND) - pkg_check_modules(_dbus_hint QUIET dbus-1) +if(DBUS_INCLUDES AND DBUS_LIBRARIES) + set(DBUS_FIND_QUIETLY TRUE) endif() -set(dbus_vars DBUS_INCLUDE_DIR) -##find_library(DBUS_LIBRARY -## NAMES -## dbus -## HINTS -## ${DBUS_ROOT_DIR} -## ${_dbus_hint_LIBRARY_DIRS} -## PATH_SUFFIXES -## lib -## lib32 -## lib64 -##) -##list(APPEND dbus_vars DBUS_LIBRARY) - -find_path(DBUS_INCLUDE_DIR +find_path(DBUS_INCLUDES NAMES dbus/dbus.h + PATH_SUFFIXES dbus-1.0 HINTS - ${DBUS_ROOT_DIR} - ${_dbus_hint_INCLUDE_DIRS} - PATH_SUFFIXES - include/ - include/dbus-1.0/ - dbus-1.0/ + $ENV{DBUSDIR}/include + /usr/include + /usr/local/include + ${INCLUDE_INSTALL_DIR} ) -find_path(DBUS_ARCH_INCLUDE_DIR - NAMES - dbus/dbus-arch-deps.h +find_library(DBUS_LIBRARIES + dbus-1 HINTS - ${DBUS_ROOT_DIR} - ${_dbus_hint_INCLUDE_DIRS} - ${_dbus_hint_LIBRARY_DIRS} - PATH_SUFFIXES - include/ - include/dbus-1.0/ - dbus-1.0/ + $ENV{DBUSDIR}/lib + /usr/lib + /usr/local/lib + ${LIB_INSTALL_DIR} ) -list(APPEND dbus_vars DBUS_ARCH_INCLUDE_DIR) -# handle the QUIETLY and REQUIRED arguments and set DBUS_FOUND to TRUE if -# all listed variables are TRUE include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(dbus - DEFAULT_MSG - ${dbus_vars}) +find_package_handle_standard_args(DBUS DEFAULT_MSG DBUS_INCLUDES DBUS_LIBRARIES) -if(DBUS_FOUND) - # Set variables containing libraries and their dependencies - # Always use the plural form for the variables defined by other find modules: - # they might have dependencies too! - ##list(APPEND DBUS_LIBRARIES ${DBUS_LIBRARY}) - set(DBUS_INCLUDE_DIRS ${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR}) - mark_as_advanced(DBUS_ROOT_DIR) -endif() - -mark_as_advanced(${dbus_vars}) - -# End of Finddbus.cmake +mark_as_advanced(DBUS_INCLUDES DBUS_LIBRARIES) diff --git a/cmake/modules/FindEGL.cmake b/cmake/modules/FindEGL.cmake index ef7672244..585189f11 100644 --- a/cmake/modules/FindEGL.cmake +++ b/cmake/modules/FindEGL.cmake @@ -11,7 +11,7 @@ if(EGL_INCLUDES AND EGL_LIBRARIES) set(EGL_FIND_QUIETLY TRUE) -endif(EGL_INCLUDES AND EGL_LIBRARIES) +endif() find_path(EGL_INCLUDES NAMES diff --git a/cmake/modules/FindMNG.cmake b/cmake/modules/FindMNG.cmake index 480feeabd..3f6c0cc8b 100644 --- a/cmake/modules/FindMNG.cmake +++ b/cmake/modules/FindMNG.cmake @@ -11,7 +11,7 @@ if (MNG_INCLUDES AND MNG_LIBRARIES) set(MNG_FIND_QUIETLY TRUE) -endif (MNG_INCLUDES AND MNG_LIBRARIES) +endif() if (NOT WIN32) # use pkg-config to get the directories and then use these values diff --git a/cmake/modules/FindNAS.cmake b/cmake/modules/FindNAS.cmake index f4eef573d..08f3f6abb 100644 --- a/cmake/modules/FindNAS.cmake +++ b/cmake/modules/FindNAS.cmake @@ -11,7 +11,7 @@ if(NAS_INCLUDES AND NAS_LIBRARIES) set(NAS_FIND_QUIETLY TRUE) -endif(NAS_INCLUDES AND NAS_LIBRARIES) +endif() find_path(NAS_INCLUDES NAMES diff --git a/cmake/modules/FindSqlite.cmake b/cmake/modules/FindSqlite.cmake index 7101d3fef..4f6e5cc4f 100644 --- a/cmake/modules/FindSqlite.cmake +++ b/cmake/modules/FindSqlite.cmake @@ -11,7 +11,7 @@ if(SQLITE_INCLUDES AND SQLITE_LIBRARIES) set(SQLITE_FIND_QUIETLY TRUE) -endif(SQLITE_INCLUDES AND SQLITE_LIBRARIES) +endif() find_path(SQLITE_INCLUDES NAMES diff --git a/cmake/modules/KatieMacros.cmake b/cmake/modules/KatieMacros.cmake index 12ca0b33d..a26c0736c 100644 --- a/cmake/modules/KatieMacros.cmake +++ b/cmake/modules/KatieMacros.cmake @@ -5,7 +5,7 @@ macro(KATIE_RESOURCES RESOURCES) foreach(tmpres ${RESOURCES} ${ARGN}) get_filename_component(resource ${tmpres} ABSOLUTE) get_source_file_property(skip ${resource} SKIP_RESOURCE) - if(NOT skip) + if(NOT skip) get_filename_component(rscext ${resource} EXT) get_filename_component(rscname ${resource} NAME_WE) get_filename_component(rscpath ${resource} PATH) @@ -39,8 +39,8 @@ macro(KATIE_RESOURCES RESOURCES) set(mocargs ${mocargs} -I${incdir}) endforeach() add_custom_command( - OUTPUT "${rscout}" - COMMAND "${KATIE_MOC}" -nw "${resource}" -o "${rscout}" ${mocargs} + OUTPUT ${rscout} + COMMAND ${KATIE_MOC} -nw "${resource}" -o "${rscout}" ${mocargs} ) set_property(SOURCE ${resource} APPEND PROPERTY OBJECT_DEPENDS ${rscout}) # XXX: this can be troublesome but common sources can cause multiple rules on the same file @@ -55,7 +55,6 @@ macro(KATIE_RESOURCE SRCDEP RESOURCES OUTNAME) add_custom_command( OUTPUT "${rscout}" COMMAND "${KATIE_RCC}" ${RESOURCES} -o "${rscout}" -name "${OUTNAME}" - # MAIN_DEPENDENCY ${resource} ) set_property(SOURCE ${SRCDEP} APPEND PROPERTY OBJECT_DEPENDS ${rscout}) endmacro() diff --git a/src/dbus/CMakeLists.txt b/src/dbus/CMakeLists.txt index 128757003..7e409e65d 100644 --- a/src/dbus/CMakeLists.txt +++ b/src/dbus/CMakeLists.txt @@ -45,8 +45,6 @@ set(DBUS_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/qdbuspendingreply.h ${CMAKE_CURRENT_SOURCE_DIR}/qdbuscontext.h ${CMAKE_CURRENT_SOURCE_DIR}/qdbusvirtualobject.h - - # FIXME: private? ${CMAKE_CURRENT_SOURCE_DIR}/qdbusconnection_p.h ${CMAKE_CURRENT_SOURCE_DIR}/qdbusmessage_p.h ${CMAKE_CURRENT_SOURCE_DIR}/qdbusinterface_p.h @@ -107,7 +105,7 @@ include_directories( ${CMAKE_BINARY_DIR}/include/QtXml ${CMAKE_BINARY_DIR}/privateinclude/QtXml ${CMAKE_CURRENT_SOURCE_DIR} - ${DBUS_INCLUDE_DIRS} + ${DBUS_INCLUDES} ) if(KATIE_PLATFORM STREQUAL "win32")