From 69c0c16af749650d58e4f7b2cd24d672147b533b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Sun, 11 Dec 2011 13:31:13 +0100 Subject: -separate find-modules and other modules into two separate directories, so they can be handled differently (the macros can't clash with stuff from cmake, since they all have the ECM prefix) Alex --- CMakeLists.txt | 7 ++++-- extra-cmake-modules-config.cmake.in | 8 ++++++- find-modules/FindBlueZ.cmake | 44 +++++++++++++++++++++++++++++++++++++ modules/FindBlueZ.cmake | 44 ------------------------------------- 4 files changed, 56 insertions(+), 47 deletions(-) create mode 100644 find-modules/FindBlueZ.cmake delete mode 100644 modules/FindBlueZ.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 294d9921..8a43e944 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,7 @@ set(ECM_VERSION ${ECM_MAJOR_VERSION}.${ECM_MINOR_VERSION}.${ECM_PATCH_VERSION}) set(SHARE_INSTALL_DIR share/extra-cmake-modules-${ECM_VERSION}) set(MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/modules/) +set(FIND_MODULES_INSTALL_DIR ${SHARE_INSTALL_DIR}/find-modules/) set(CMAKECONFIG_INSTALL_DIR ${SHARE_INSTALL_DIR}/cmake/) set(DOC_INSTALL_DIR ${SHARE_INSTALL_DIR}/doc/) @@ -27,9 +28,11 @@ install(FILES "${CMAKE_BINARY_DIR}/extra-cmake-modules.txt" "${CMAKE_BINARY_DIR} DESTINATION ${DOC_INSTALL_DIR}) -file(GLOB installFiles ${CMAKE_SOURCE_DIR}/modules/*[^~]) +file(GLOB installModuleFiles ${CMAKE_SOURCE_DIR}/modules/*[^~]) +install(FILES ${installModuleFiles} DESTINATION ${MODULES_INSTALL_DIR}) -install(FILES ${installFiles} DESTINATION ${MODULES_INSTALL_DIR}) +file(GLOB installFindModuleFiles ${CMAKE_SOURCE_DIR}/find-modules/*[^~]) +install(FILES ${installFindModuleFiles} DESTINATION ${FIND_MODULES_INSTALL_DIR}) # figure out the relative path from the installed Config.cmake file to the install prefix (which may be at # runtime different from the chosen CMAKE_INSTALL_PREFIX if under Windows the package was installed anywhere) diff --git a/extra-cmake-modules-config.cmake.in b/extra-cmake-modules-config.cmake.in index 22e9eb6c..5a135ea5 100644 --- a/extra-cmake-modules-config.cmake.in +++ b/extra-cmake-modules-config.cmake.in @@ -6,4 +6,10 @@ set(EXTRA_CMAKE_MODULES_VERSION_MINOR @ECM_MINOR_VERSION@) set(EXTRA_CMAKE_MODULES_VERSION_PATCH @ECM_PATCH_VERSION@) set(EXTRA_CMAKE_MODULES_VERSION ${EXTRA_CMAKE_MODULES_VERSION_MAJOR}.${EXTRA_CMAKE_MODULES_VERSION_MINOR}.${EXTRA_CMAKE_MODULES_VERSION_PATCH}) -set(EXTRA_CMAKE_MODULES_MODULE_PATH "${rootDir}/@MODULES_INSTALL_DIR@") + +set(EXTRA_CMAKE_MODULES_FIND_MODULE_DIR "${rootDir}/@FIND_MODULES_INSTALL_DIR@") + +set(EXTRA_CMAKE_MODULES_MODULE_DIR "${rootDir}/@MODULES_INSTALL_DIR@") + +set(EXTRA_CMAKE_MODULES_MODULE_PATH "${EXTRA_CMAKE_MODULES_MODULE_DIR}" "${EXTRA_CMAKE_MODULES_FIND_MODULE_DIR}") + diff --git a/find-modules/FindBlueZ.cmake b/find-modules/FindBlueZ.cmake new file mode 100644 index 00000000..04e636f6 --- /dev/null +++ b/find-modules/FindBlueZ.cmake @@ -0,0 +1,44 @@ +# - Try to find BlueZ bluetooth library. +# Once done this will define +# +# BLUEZ_FOUND - system has BlueZ +# BLUEZ_INCLUDE_DIR - the BlueZ include directory +# BLUEZ_LIBRARIES - Link these to use BlueZ +# BLUEZ_DEFINITIONS - Compiler switches required for using BlueZ +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# + +# Copyright (c) 2008, Daniel Gollub, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +# use pkg-config to get the directories and then use these values +# in the FIND_PATH() and FIND_LIBRARY() calls +find_package(PkgConfig) +pkg_check_modules(PC_BLUEZ QUIET bluez) + +set(BLUEZ_DEFINITIONS ${PC_BLUEZ_CFLAGS_OTHER}) + +find_path(BLUEZ_INCLUDE_DIR NAMES bluetooth/bluetooth.h + PATHS + ${PC_BLUEZ_INCLUDEDIR} + ${PC_BLUEZ_INCLUDE_DIRS} + /usr/X11/include +) + +find_library(BLUEZ_LIBRARY NAMES bluetooth + PATHS + ${PC_BLUEZ_LIBDIR} + ${PC_BLUEZ_LIBRARY_DIRS} +) + +set(BLUEZ_LIBRARIES ${BLUEZ_LIBRARY}) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(BlueZ DEFAULT_MSG BLUEZ_LIBRARY BLUEZ_INCLUDE_DIR) + +# show the BLUEZ_INCLUDE_DIR and BLUEZ_LIBRARY variables only in the advanced view +mark_as_advanced(BLUEZ_INCLUDE_DIR BLUEZ_LIBRARY) diff --git a/modules/FindBlueZ.cmake b/modules/FindBlueZ.cmake deleted file mode 100644 index 04e636f6..00000000 --- a/modules/FindBlueZ.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Try to find BlueZ bluetooth library. -# Once done this will define -# -# BLUEZ_FOUND - system has BlueZ -# BLUEZ_INCLUDE_DIR - the BlueZ include directory -# BLUEZ_LIBRARIES - Link these to use BlueZ -# BLUEZ_DEFINITIONS - Compiler switches required for using BlueZ -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. -# - -# Copyright (c) 2008, Daniel Gollub, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -# use pkg-config to get the directories and then use these values -# in the FIND_PATH() and FIND_LIBRARY() calls -find_package(PkgConfig) -pkg_check_modules(PC_BLUEZ QUIET bluez) - -set(BLUEZ_DEFINITIONS ${PC_BLUEZ_CFLAGS_OTHER}) - -find_path(BLUEZ_INCLUDE_DIR NAMES bluetooth/bluetooth.h - PATHS - ${PC_BLUEZ_INCLUDEDIR} - ${PC_BLUEZ_INCLUDE_DIRS} - /usr/X11/include -) - -find_library(BLUEZ_LIBRARY NAMES bluetooth - PATHS - ${PC_BLUEZ_LIBDIR} - ${PC_BLUEZ_LIBRARY_DIRS} -) - -set(BLUEZ_LIBRARIES ${BLUEZ_LIBRARY}) - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(BlueZ DEFAULT_MSG BLUEZ_LIBRARY BLUEZ_INCLUDE_DIR) - -# show the BLUEZ_INCLUDE_DIR and BLUEZ_LIBRARY variables only in the advanced view -mark_as_advanced(BLUEZ_INCLUDE_DIR BLUEZ_LIBRARY) -- cgit v1.2.1