[Cmake-commits] CMake branch, next, updated. v2.8.7-2839-g18d8ef2

Alexander Neundorf neundorf at kde.org
Thu Feb 23 15:44:00 EST 2012


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  18d8ef268ab8f20b9e78277db61b5db952864411 (commit)
       via  497a6b2cdf854a8160976eb22cf92929acc60282 (commit)
       via  7e3132ac4ed0d17e0ed1283f0a556f7928f6ec87 (commit)
       via  41c627952ed06a62eab35f68235f9e06c3eba2d3 (commit)
      from  2ebf28ea430b136d67dd50468ea7578842421cf9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=18d8ef268ab8f20b9e78277db61b5db952864411
commit 18d8ef268ab8f20b9e78277db61b5db952864411
Merge: 2ebf28e 497a6b2
Author:     Alexander Neundorf <neundorf at kde.org>
AuthorDate: Thu Feb 23 15:43:57 2012 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Feb 23 15:43:57 2012 -0500

    Merge topic 'MakingConfigFilesEasier_ConfigureMacro' into next
    
    497a6b2 wrap write_basic_config_version_file as write_basic_package_version_file()
    7e3132a configure_package_config_file(): add test and fix bug
    41c6279 add CMakePackageConfigHelpers: configure_package_config_file()


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=497a6b2cdf854a8160976eb22cf92929acc60282
commit 497a6b2cdf854a8160976eb22cf92929acc60282
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Fri Feb 17 00:36:18 2012 +0100
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Fri Feb 17 00:36:18 2012 +0100

    wrap write_basic_config_version_file as write_basic_package_version_file()
    
    So the name fits better with configure_package_config_file(), as
    discussed on the mailing list. Adapt the documentation accordingly.
    
    Alex

diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 5c9b3f5..e66999b 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -58,7 +58,32 @@
 # When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the
 # FooConfig.cmake file.
 #
-# Example:
+# For an example see below the documentation for WRITE_BASIC_PACKAGE_VERSION_FILE().
+#
+#
+#  WRITE_BASIC_PACKAGE_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
+#
+# Writes a file for use as <package>ConfigVersion.cmake file to <filename>.
+# See the documentation of FIND_PACKAGE() for details on this.
+#    filename is the output filename, it should be in the build tree.
+#    major.minor.patch is the version number of the project to be installed
+# The COMPATIBILITY mode AnyNewerVersion means that the installed package version
+# will be considered compatible if it is newer or exactly the same as the requested version.
+# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion
+# in that the major version number must be the same as requested, e.g. version 2.0 will
+# not be considered compatible if 1.0 is requested.
+# If your project has more elaborated version matching rules, you will need to write your
+# own custom ConfigVersion.cmake file instead of using this macro.
+#
+# Internally, this macro executes configure_file() to create the resulting
+# version file. Depending on the COMPATIBLITY, either the file
+# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in
+# is used. Please note that these two files are internal to CMake and you should
+# not call configure_file() on them yourself, but they can be used as starting
+# point to create more sophisticted custom ConfigVersion.cmake files.
+#
+#
+# Example using both configure_package_config_file() and write_basic_package_version_file():
 # CMakeLists.txt:
 #   set(INCLUDE_INSTALL_DIR include/ ... CACHE )
 #   set(LIB_INSTALL_DIR lib/ ... CACHE )
@@ -68,9 +93,13 @@
 #   configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
 #                                 INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
 #                                 PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
-#  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
+#   write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+#                                    VERSION 1.2.3
+#                                    COMPATIBILITY SameMajorVersion )
+#   install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
+#           DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
 #
-# FooConfig.cmake.in:
+# With a FooConfig.cmake.in:
 #   set(FOO_VERSION x.y.z)
 #   ...
 #   @PACKAGE_HELPER_INIT@
@@ -94,6 +123,12 @@
 
 include(CMakeParseArguments)
 
+include(WriteBasicConfigVersionFile)
+
+macro(WRITE_BASIC_PACKAGE_VERSION_FILE)
+  write_basic_config_version_file(${ARGN})
+endmacro()
+
 
 function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
   set(options NO_SET_AND_CHECK_MACRO)
diff --git a/Modules/WriteBasicConfigVersionFile.cmake b/Modules/WriteBasicConfigVersionFile.cmake
index 0b6519d..038cb57 100644
--- a/Modules/WriteBasicConfigVersionFile.cmake
+++ b/Modules/WriteBasicConfigVersionFile.cmake
@@ -1,31 +1,6 @@
 #  WRITE_BASIC_CONFIG_VERSION_FILE( filename VERSION major.minor.patch COMPATIBILITY (AnyNewerVersion|SameMajorVersion) )
 #
-# Writes a file for use as <package>ConfigVersion.cmake file to <filename>.
-# See the documentation of FIND_PACKAGE() for details on this.
-#    filename is the output filename, it should be in the build tree.
-#    major.minor.patch is the version number of the project to be installed
-# The COMPATIBILITY mode AnyNewerVersion means that the installed package version
-# will be considered compatible if it is newer or exactly the same as the requested version.
-# If SameMajorVersion is used instead, then the behaviour differs from AnyNewerVersion
-# in that the major version number must be the same as requested, e.g. version 2.0 will
-# not be considered compatible if 1.0 is requested.
-# If your project has more elaborated version matching rules, you will need to write your
-# own custom ConfigVersion.cmake file instead of using this macro.
-#
-# Example:
-#     write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
-#                                     VERSION 1.2.3
-#                                     COMPATIBILITY SameMajorVersion )
-#     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake
-#                   ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
-#             DESTINATION lib/cmake/Foo )
-#
-# Internally, this macro executes configure_file() to create the resulting
-# version file. Depending on the COMPATIBLITY, either the file
-# BasicConfigVersion-SameMajorVersion.cmake.in or BasicConfigVersion-AnyNewerVersion.cmake.in
-# is used. Please note that these two files are internal to CMake and you should
-# not call configure_file() on them yourself, but they can be used as starting
-# point to create more sophisticted custom ConfigVersion.cmake files.
+# Deprecated, see WRITE_BASIC_PACKAGE_VERSION_FILE(), it is identical.
 
 #=============================================================================
 # Copyright 2008-2011 Alexander Neundorf, <neundorf at kde.org>
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 22bb628..04432ca 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -192,7 +192,7 @@ void cmFindPackageCommand::GenerateDocumentation()
     "If no such version file is available then the configuration file "
     "is assumed to not be compatible with any requested version.  "
     "A basic version file containing generic version matching code can be "
-    "created using the macro write_basic_config_version_file(), see its "
+    "created using the macro write_basic_package_version_file(), see its "
     "documentation for more details.  "
     "When a version file is found it is loaded to check the requested "
     "version number.  "
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 19255bf..a4f213b 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -335,11 +335,9 @@ endif()
 #-----------------------------------------------------------------------------
 # Test write_basic_config_version_file().
 
-include(WriteBasicConfigVersionFile)
-
-write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
-                                VERSION 1.2.3
-                                COMPATIBILITY AnyNewerVersion)
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
+                                 VERSION 1.2.3
+                                 COMPATIBILITY AnyNewerVersion)
 
 set(PACKAGE_FIND_VERSION 2.3.4)
 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
@@ -373,6 +371,7 @@ endif()
 
 
 #######################
+include(WriteBasicConfigVersionFile)
 
 write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake
                                 VERSION 1.2.3

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7e3132ac4ed0d17e0ed1283f0a556f7928f6ec87
commit 7e3132ac4ed0d17e0ed1283f0a556f7928f6ec87
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Fri Feb 17 00:23:45 2012 +0100
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Fri Feb 17 00:23:45 2012 +0100

    configure_package_config_file(): add test and fix bug
    
    The case that INSTALL_DESTINATION was already absolute was not
    handled correctly.
    
    Alex

diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
index 6b950dc..5c9b3f5 100644
--- a/Modules/CMakePackageConfigHelpers.cmake
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -110,7 +110,9 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
     message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_CONFIG_FILE()")
   endif()
 
-  if(NOT IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
+  if(IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
+    set(absInstallDir "${CCF_INSTALL_DESTINATION}")
+  else()
     set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
   endif()
   file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 9a4bdfe..19255bf 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -305,6 +305,34 @@ STRING(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
 FIND_PACKAGE(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
 
 #-----------------------------------------------------------------------------
+# Test configure_package_config_file().
+
+include(CMakePackageConfigHelpers)
+
+set(INCLUDE_INSTALL_DIR include )
+set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
+set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
+
+configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
+                              INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
+                              PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
+                             )
+
+include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
+
+if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
+  message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")")
+endif()
+
+if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
+  message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")")
+endif()
+
+if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
+  message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")")
+endif()
+
+#-----------------------------------------------------------------------------
 # Test write_basic_config_version_file().
 
 include(WriteBasicConfigVersionFile)
diff --git a/Tests/FindPackageTest/RelocatableConfig.cmake.in b/Tests/FindPackageTest/RelocatableConfig.cmake.in
new file mode 100644
index 0000000..607732a
--- /dev/null
+++ b/Tests/FindPackageTest/RelocatableConfig.cmake.in
@@ -0,0 +1,5 @@
+ at PACKAGE_HELPER_INIT@
+
+set(RELOC_INCLUDE_DIR "@PACKAGE_HELPER_INCLUDE_INSTALL_DIR@")
+set(RELOC_SHARE_DIR "@PACKAGE_HELPER_SHARE_INSTALL_DIR@")
+set_and_check(RELOC_BUILD_DIR "@PACKAGE_HELPER_CURRENT_BUILD_DIR@")

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=41c627952ed06a62eab35f68235f9e06c3eba2d3
commit 41c627952ed06a62eab35f68235f9e06c3eba2d3
Author:     Alex Neundorf <neundorf at kde.org>
AuthorDate: Thu Feb 16 23:12:14 2012 +0100
Commit:     Alex Neundorf <neundorf at kde.org>
CommitDate: Thu Feb 16 23:12:14 2012 +0100

    add CMakePackageConfigHelpers: configure_package_config_file()
    
    The function configure_package_config_file() should be used instead
    of configure_file() for generating the Config.cmake files for installation,
    they help to make those files relocatable.
    
    Alex

diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake
new file mode 100644
index 0000000..6b950dc
--- /dev/null
+++ b/Modules/CMakePackageConfigHelpers.cmake
@@ -0,0 +1,152 @@
+# - CONFIGURE_PACKAGE_CONFIG_FILE(), WRITE_BASIC_PACKAGE_VERSION_FILE()
+#
+#    CONFIGURE_PACKAGE_CONFIG_FILE(<input> <output> INSTALL_DESTINATION <path>
+#                                                   [PATH_VARS <var1> <var2> ... <varN>]
+#                                                   [NO_SET_AND_CHECK_MACRO] )
+#
+# CONFIGURE_PACKAGE_CONFIG_FILE() should be used instead of the plain
+# CONFIGURE_FILE() command when creating the <Name>Config.cmake or <Name>-config.cmake
+# file for installing a project or library. It helps making the resulting package
+# relocatable by avoiding hardcoded paths in the installed Config.cmake file.
+#
+# In a FooConfig.cmake file there may be code like this to make the
+# install destinations know to the using project:
+#   set(FOO_INCLUDE_DIR   "@CMAKE_INSTALL_FULL_INCLUDEDIR@" )
+#   set(FOO_DATA_DIR   "@CMAKE_INSTALL_PREFIX@/@RELATIVE_DATA_INSTALL_DIR@" )
+#   set(FOO_ICONS_DIR   "@CMAKE_INSTALL_PREFIX@/share/icons" )
+#   ...logic to determine installedPrefix from the own location...
+#   set(FOO_CONFIG_DIR  "${installedPrefix}/@CONFIG_INSTALL_DIR@" )
+# All 4 options shown above are not sufficient, since the first 3 hardcode
+# the absolute directory locations, and the 4th case works only if the logic
+# to determine the installedPrefix is correct, and if CONFIG_INSTALL_DIR contains
+# a relative path, which in general cannot be guaranteed.
+# This has the effect that the resulting FooConfig.cmake file would work poorly
+# under Windows and OSX, where users are used to choose the install location
+# of a binary package at install time, independent from how CMAKE_INSTALL_PREFIX
+# was set at build/cmake time.
+#
+# Using CONFIGURE_PACKAGE_CONFIG_FILE() helps. If used correctly, it makes the
+# resulting FooConfig.cmake file relocatable.
+# Usage:
+#   1. write a FooConfig.cmake.in file as you are used to
+#   2. insert a line containing only the string "@PACKAGE_HELPER_INIT@"
+#   3. instead of SET(FOO_DIR "@SOME_INSTALL_DIR@"), use SET(FOO_DIR "@PACKAGE_HELPER_SOME_INSTALL_DIR@")
+#      (this must be after the @PACKAGE_HELPER_INIT@ line)
+#   4. instead of using the normal CONFIGURE_FILE(), use CONFIGURE_PACKAGE_CONFIG_FILE()
+#
+# The <input> and <output> arguments are the input and output file, the same way
+# as in CONFIGURE_FILE().
+#
+# The <path> given to INSTALL_DESTINATION must be the destination where the FooConfig.cmake
+# file will be installed to. This can either be a relative or absolute path, both work.
+#
+# The variables <var1> to <varN> given as PATH_VARS are the variables which contain
+# install destinations. For each of them the macro will create a helper variable
+# PACKAGE_HELPER_<var...>. These helper variables must be used
+# in the FooConfig.cmake.in file for setting the installed location. They are calculated
+# by CONFIGURE_PACKAGE_CONFIG_FILE() so that they are always relative to the
+# installed location of the package. This works both for relative and also for absolute locations.
+# For absolute locations it works only if the absolute location is a subdirectory
+# of CMAKE_INSTALL_PREFIX.
+#
+# By default configure_package_config_file() also generates a macro set_and_check()
+# into the FooConfig.cmake file. This should be used instead of the normal set()
+# command for setting directories and file locations. Additionally to setting the
+# variable it also checks that the referenced file or directory actually exists
+# and fails with a FATAL_ERROR otherwise. This makes sure that the created
+# FooConfig.cmake file does not contain wrong references.
+# When using the NO_SET_AND_CHECK_MACRO, this macro is not generated into the
+# FooConfig.cmake file.
+#
+# Example:
+# CMakeLists.txt:
+#   set(INCLUDE_INSTALL_DIR include/ ... CACHE )
+#   set(LIB_INSTALL_DIR lib/ ... CACHE )
+#   set(SYSCONFIG_INSTALL_DIR etc/foo/ ... CACHE )
+#   ...
+#   include(CMakePackageConfigHelpers)
+#   configure_package_config_file(FooConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake
+#                                 INSTALL_DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake
+#                                 PATH_VARS INCLUDE_INSTALL_DIR SYSCONFIG_INSTALL_DIR)
+#  install(FILES ${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake DESTINATION ${LIB_INSTALL_DIR}/Foo/cmake )
+#
+# FooConfig.cmake.in:
+#   set(FOO_VERSION x.y.z)
+#   ...
+#   @PACKAGE_HELPER_INIT@
+#   ...
+#   set_and_check(FOO_INCLUDE_DIR "@PACKAGE_HELPER_INCLUDE_INSTALL_DIR@")
+#   set_and_check(FOO_SYSCONFIG_DIR "@PACKAGE_HELPER_SYSCONFIG_INSTALL_DIR@")
+
+
+#=============================================================================
+# Copyright 2012 Alexander Neundorf <neundorf at kde.org>
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+include(CMakeParseArguments)
+
+
+function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
+  set(options NO_SET_AND_CHECK_MACRO)
+  set(oneValueArgs INSTALL_DESTINATION )
+  set(multiValueArgs PATH_VARS )
+
+  cmake_parse_arguments(CCF "${options}" "${oneValueArgs}" "${multiValueArgs}"  ${ARGN})
+
+  if(CCF_UNPARSED_ARGUMENTS)
+    message(FATAL_ERROR "Unknown keywords given to CONFIGURE_CONFIG_FILE(): \"${CCF_UNPARSED_ARGUMENTS}\"")
+  endif()
+
+  if(NOT CCF_INSTALL_DESTINATION)
+    message(FATAL_ERROR "No INSTALL_DESTINATION given to CONFIGURE_CONFIG_FILE()")
+  endif()
+
+  if(NOT IS_ABSOLUTE "${CCF_INSTALL_DESTINATION}")
+    set(absInstallDir "${CMAKE_INSTALL_PREFIX}/${CCF_INSTALL_DESTINATION}")
+  endif()
+  file(RELATIVE_PATH PACKAGE_RELATIVE_PATH "${absInstallDir}" "${CMAKE_INSTALL_PREFIX}" )
+
+  foreach(var ${CCF_PATH_VARS})
+    if(NOT DEFINED ${var})
+      message(FATAL_ERROR "Variable ${var} does not exist")
+    else()
+      if(IS_ABSOLUTE "${${var}}")
+        string(REPLACE "${CMAKE_INSTALL_PREFIX}" "\${PACKAGE_PREFIX_DIR}"
+                        PACKAGE_HELPER_${var} "${${var}}")
+      else()
+        set(PACKAGE_HELPER_${var} "\${PACKAGE_PREFIX_DIR}/${${var}}")
+      endif()
+    endif()
+  endforeach()
+
+  set(PACKAGE_HELPER_INIT "
+####### Expanded from @PACKAGE_HELPER_INIT@ by ConfigureConfigFile.cmake #######
+get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
+")
+
+  if(NOT CCF_NO_SET_AND_CHECK_MACRO)
+    set(PACKAGE_HELPER_INIT "${PACKAGE_HELPER_INIT}
+macro(set_and_check _var _file)
+  set(\${_var} \"\${_file}\")
+  if(NOT EXISTS \"\${_file}\")
+    message(FATAL_ERROR \"File or directory \${_file} referenced by variable \${_var} does not exist !\")
+  endif()
+endmacro()
+")
+  endif()
+
+  set(PACKAGE_HELPER_INIT "${PACKAGE_HELPER_INIT}
+####################################################################################")
+
+  configure_file("${_inputFile}" "${_outputFile}" @ONLY)
+
+endfunction()

-----------------------------------------------------------------------

Summary of changes:
 Modules/CMakePackageConfigHelpers.cmake          |  189 ++++++++++++++++++++++
 Modules/WriteBasicConfigVersionFile.cmake        |   27 +---
 Source/cmFindPackageCommand.cxx                  |    2 +-
 Tests/FindPackageTest/CMakeLists.txt             |   37 ++++-
 Tests/FindPackageTest/RelocatableConfig.cmake.in |    5 +
 5 files changed, 228 insertions(+), 32 deletions(-)
 create mode 100644 Modules/CMakePackageConfigHelpers.cmake
 create mode 100644 Tests/FindPackageTest/RelocatableConfig.cmake.in


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list