Commit 792072c3 authored by Chad Versace's avatar Chad Versace

Merge branch 'maint-1.4' into maint-1.5

* maint-1.4:
  cmake: Add cmake PackageConfig files
  cmake: fix version search
parents fc9db89c 622efdd3
......@@ -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
# ------------------------------------------------------------------------------
......
WaffleConfigVersion.cmake
WaffleConfig.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)
# 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@")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment