summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Versace <chad.versace@linux.intel.com>2014-12-31 18:45:03 -0800
committerChad Versace <chad.versace@linux.intel.com>2014-12-31 18:45:03 -0800
commit792072c3b592e0e2286b9faaf7be3a05e4a9e873 (patch)
treefe3899f550917fbfa5a719ff9b2dbca711eee4ed
parentfc9db89c53a2e6e65751bcd87337c74fa05de182 (diff)
parent622efdd3f3e832ac34edb9f7f54bb675f0fdec13 (diff)
Merge branch 'maint-1.4' into maint-1.5
* maint-1.4: cmake: Add cmake PackageConfig files cmake: fix version search
-rw-r--r--CMakeLists.txt27
-rw-r--r--cmake/Modules/.gitignore2
-rw-r--r--cmake/Modules/FindWaffle.cmake6
-rw-r--r--cmake/Modules/WaffleConfig.cmake.in12
4 files changed, 42 insertions, 5 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index bde8096..6fabb54 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -128,7 +128,8 @@ if(waffle_build_examples)
endif()
# ------------------------------------------------------------------------------
-# Install packaging files: waffle.pc, FindWaffle.cmake
+# Install packaging files: waffle.pc, FindWaffle.cmake,
+# WaffleConfigVersion.cmake, and WaffleConfig.cmake
# ------------------------------------------------------------------------------
configure_file(waffle.pc.in ${waffle_libname}.pc @ONLY)
@@ -145,6 +146,30 @@ install(
COMPONENT cmakefind
)
+set(ConfigPackageLocation "${CMAKE_INSTALL_LIBDIR}/cmake/Waffle")
+include(CMakePackageConfigHelpers)
+write_basic_package_version_file(
+ "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake"
+ VERSION "${waffle_version}"
+ COMPATIBILITY SameMajorVersion
+)
+
+configure_package_config_file(
+ cmake/Modules/WaffleConfig.cmake.in
+ cmake/Modules/WaffleConfig.cmake
+ INSTALL_DESTINATION "${ConfigPackageLocation}"
+ PATH_VARS CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO
+)
+
+install(
+ FILES
+ "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfigVersion.cmake"
+ "${CMAKE_BINARY_DIR}/cmake/Modules/WaffleConfig.cmake"
+ DESTINATION "${ConfigPackageLocation}"
+ COMPONENT devel
+)
+
# ------------------------------------------------------------------------------
# Install core documentation
# ------------------------------------------------------------------------------
diff --git a/cmake/Modules/.gitignore b/cmake/Modules/.gitignore
new file mode 100644
index 0000000..9742f46
--- /dev/null
+++ b/cmake/Modules/.gitignore
@@ -0,0 +1,2 @@
+WaffleConfigVersion.cmake
+WaffleConfig.cmake
diff --git a/cmake/Modules/FindWaffle.cmake b/cmake/Modules/FindWaffle.cmake
index 972bdfe..4e16c4e 100644
--- a/cmake/Modules/FindWaffle.cmake
+++ b/cmake/Modules/FindWaffle.cmake
@@ -48,8 +48,8 @@ find_library(WAFFLE_LIBRARIES
NAMES "waffle-${WAFFLE_FIND_VERSION_MAJOR}"
)
-if(WAFFLE_INCLUDE_DIR AND EXISTS "${WAFFLE_INCLUDE_DIR}/waffle_version.h")
- file(STRINGS "${WAFFLE_INCLUDE_DIR}/waffle_version.h" WAFFLE_VERSION_H)
+if(WAFFLE_INCLUDE_DIRS AND EXISTS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h")
+ file(STRINGS "${WAFFLE_INCLUDE_DIRS}/waffle_version.h" WAFFLE_VERSION_H)
string(REGEX REPLACE "^.*WAFFLE_MAJOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MAJOR_VERSION "${WAFFLE_VERSION_H}")
string(REGEX REPLACE "^.*WAFFLE_MINOR_VERSION ([0-9]+).*$" "\\1" WAFFLE_MINOR_VERSION "${WAFFLE_VERSION_H}")
string(REGEX REPLACE "^.*WAFFLE_PATCH_VERSION ([0-9]+).*$" "\\1" WAFFLE_PATCH_VERSION "${WAFFLE_VERSION_H}")
@@ -72,9 +72,7 @@ mark_as_advanced(WAFFLE_LIBRARIES WAFFLE_INCLUDE_DIRS)
# variables from the cache *and* local scope.
#
unset(WAFFLE_FIND_VERSION_MAJOR CACHE)
-unset(WAFFLE_INCLUDE_DIR CACHE)
unset(WAFFLE_VERSION_H CACHE)
unset(WAFFLE_FIND_VERSION_MAJOR)
-unset(WAFFLE_INCLUDE_DIR)
unset(WAFFLE_VERSION_H)
diff --git a/cmake/Modules/WaffleConfig.cmake.in b/cmake/Modules/WaffleConfig.cmake.in
new file mode 100644
index 0000000..b60b470
--- /dev/null
+++ b/cmake/Modules/WaffleConfig.cmake.in
@@ -0,0 +1,12 @@
+# Config module for Waffle
+#
+# Provides the following variables
+# Waffle_INCLUDE_DIRS - Directories to include
+# Waffle_LIBRARIES - Libraries to link
+# Waffle_LIBRARY_DIRS - Library directories to search for link libraries
+
+@PACKAGE_INIT@
+
+set_and_check(Waffle_INCLUDE_DIRS "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@/@waffle_libname@")
+set_and_check(Waffle_LIBRARY_DIRS "@PACKAGE_CMAKE_INSTALL_LIBDIR@")
+set(Waffle_LIBRARIES "@waffle_libname@")