[Cmake-commits] CMake branch, next, updated. v3.2.0-844-g4f61b2a

Brad King brad.king at kitware.com
Thu Mar 5 10:01:37 EST 2015


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  4f61b2ad49cc88e7a6a256cad88abba01f3b0b12 (commit)
       via  9921df6e84a0a634a45dd925a0a11a6ee182d1e2 (commit)
      from  7c6a5fe2a078438b5850a75a22549f280a16f3e0 (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=4f61b2ad49cc88e7a6a256cad88abba01f3b0b12
commit 4f61b2ad49cc88e7a6a256cad88abba01f3b0b12
Merge: 7c6a5fe 9921df6
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 5 10:01:36 2015 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Mar 5 10:01:36 2015 -0500

    Merge topic 'FPHSA-ExactCase-name' into next
    
    9921df6e Revert "FPHSA: Always populate the ExactCase_FOUND variable (#15412)."


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9921df6e84a0a634a45dd925a0a11a6ee182d1e2
commit 9921df6e84a0a634a45dd925a0a11a6ee182d1e2
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Mar 5 10:00:56 2015 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Mar 5 10:00:56 2015 -0500

    Revert "FPHSA: Always populate the ExactCase_FOUND variable (#15412)."
    
    This reverts commit f6cb72e00bd813e4878902a414272a4d036b6f22.
    This will be replaced with a change that does not drop the
    enforcement of valid FOUND_VAR values.

diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake
index c6a1942..2de1fb3 100644
--- a/Modules/FindPackageHandleStandardArgs.cmake
+++ b/Modules/FindPackageHandleStandardArgs.cmake
@@ -8,9 +8,9 @@
 #
 # This function is intended to be used in FindXXX.cmake modules files.
 # It handles the REQUIRED, QUIET and version-related arguments to
-# find_package(PackageName).  It also sets the <PackageName>_FOUND
-# variable.  The package is considered found if all variables <var1>...
-# listed contain valid results, e.g.  valid filepaths.
+# find_package().  It also sets the <packagename>_FOUND variable.  The
+# package is considered found if all variables <var1>...  listed contain
+# valid results, e.g.  valid filepaths.
 #
 # There are two modes of this function.  The first argument in both
 # modes is the name of the Find-module where it is called (in original
@@ -24,7 +24,7 @@
 #       (DEFAULT_MSG|"Custom failure message") <var1>...<varN> )
 #
 # If the variables <var1> to <varN> are all valid, then
-# <PackageName>_FOUND will be set to TRUE.  If DEFAULT_MSG is given
+# <UPPERCASED_NAME>_FOUND will be set to TRUE.  If DEFAULT_MSG is given
 # as second argument, then the function will generate itself useful
 # success and error messages.  You can also supply a custom error
 # message for the failure case.  This is not recommended.
@@ -41,12 +41,16 @@
 #       [CONFIG_MODE]
 #       [FAIL_MESSAGE "Custom failure message"] )
 #
-# The FOUND_VAR option is obsolete.  ``FIND_PACKAGE_HANDLE_STANDARD_ARGS``
-# always populates ``<PackageName>_FOUND``.  For backward compatibility,
-# it also always populates ``<UPPERCASE_NAME>_FOUND``.
+# In this mode, the name of the result-variable can be set either to
+# either <UPPERCASED_NAME>_FOUND or <OriginalCase_Name>_FOUND using the
+# FOUND_VAR option.  Other names for the result-variable are not
+# allowed.  So for a Find-module named FindFooBar.cmake, the two
+# possible names are FooBar_FOUND and FOOBAR_FOUND.  It is recommended
+# to use the original case version.  If the FOUND_VAR option is not
+# used, the default is <UPPERCASED_NAME>_FOUND.
 #
 # As in the simple mode, if <var1> through <varN> are all valid,
-# <PackageName>_FOUND will be set to TRUE.  After REQUIRED_VARS the
+# <packagename>_FOUND will be set to TRUE.  After REQUIRED_VARS the
 # variables which are required for this package are listed.  Following
 # VERSION_VAR the name of the variable can be specified which holds the
 # version of the package which has been found.  If this is done, this
@@ -57,7 +61,7 @@
 # version is ok or not.  If the package supports components, use the
 # HANDLE_COMPONENTS option to enable handling them.  In this case,
 # find_package_handle_standard_args() will report which components have
-# been found and which are missing, and the <PackageName>_FOUND variable
+# been found and which are missing, and the <packagename>_FOUND variable
 # will be set to FALSE if any of the required components (i.e.  not the
 # ones listed after OPTIONAL_COMPONENTS) are missing.  Use the option
 # CONFIG_MODE if your FindXXX.cmake module is a wrapper for a
@@ -77,7 +81,7 @@
 #
 #
 # LibXml2 is considered to be found, if both LIBXML2_LIBRARY and
-# LIBXML2_INCLUDE_DIR are valid.  Then also LibXml2_FOUND is set to
+# LIBXML2_INCLUDE_DIR are valid.  Then also LIBXML2_FOUND is set to
 # TRUE.  If it is not found and REQUIRED was used, it fails with
 # FATAL_ERROR, independent whether QUIET was used or not.  If it is
 # found, success will be reported, including the content of <var1>.  On
@@ -88,14 +92,16 @@
 # ::
 #
 #     find_package_handle_standard_args(LibXslt
+#       FOUND_VAR LibXslt_FOUND
 #       REQUIRED_VARS LibXslt_LIBRARIES LibXslt_INCLUDE_DIRS
 #       VERSION_VAR LibXslt_VERSION_STRING)
 #
 # In this case, LibXslt is considered to be found if the variable(s)
 # listed after REQUIRED_VAR are all valid, i.e.  LibXslt_LIBRARIES and
-# LibXslt_INCLUDE_DIRS in this case.  Also the version of LibXslt will be
-# checked by using the version contained in LibXslt_VERSION_STRING.  Since
-# no FAIL_MESSAGE is given, the default messages will be printed.
+# LibXslt_INCLUDE_DIRS in this case.  The result will then be stored in
+# LibXslt_FOUND .  Also the version of LibXslt will be checked by using
+# the version contained in LibXslt_VERSION_STRING.  Since no
+# FAIL_MESSAGE is given, the default messages will be printed.
 #
 # Another example for mode 2:
 #
@@ -105,8 +111,9 @@
 #     find_package_handle_standard_args(Automoc4  CONFIG_MODE)
 #
 # In this case, FindAutmoc4.cmake wraps a call to find_package(Automoc4
-# NO_MODULE) and adds an additional search directory for automoc4.  The
-# following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
+# NO_MODULE) and adds an additional search directory for automoc4.  Here
+# the result will be stored in AUTOMOC4_FOUND.  The following
+# FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper
 # success/error message.
 
 #=============================================================================
@@ -217,23 +224,32 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
   string(TOUPPER ${_NAME} _NAME_UPPER)
   string(TOLOWER ${_NAME} _NAME_LOWER)
 
+  if(FPHSA_FOUND_VAR)
+    if(FPHSA_FOUND_VAR MATCHES "^${_NAME}_FOUND$"  OR  FPHSA_FOUND_VAR MATCHES "^${_NAME_UPPER}_FOUND$")
+      set(_FOUND_VAR ${FPHSA_FOUND_VAR})
+    else()
+      message(FATAL_ERROR "The argument for FOUND_VAR is \"${FPHSA_FOUND_VAR}\", but only \"${_NAME}_FOUND\" and \"${_NAME_UPPER}_FOUND\" are valid names.")
+    endif()
+  else()
+    set(_FOUND_VAR ${_NAME_UPPER}_FOUND)
+  endif()
+
   # collect all variables which were not found, so they can be printed, so the
   # user knows better what went wrong (#6375)
   set(MISSING_VARS "")
   set(DETAILS "")
   # check if all passed variables are valid
-  unset(${_NAME}_FOUND)
-  unset(${_NAME_UPPER}_FOUND)
+  unset(${_FOUND_VAR})
   foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
     if(NOT ${_CURRENT_VAR})
-      set(${_NAME}_FOUND FALSE)
+      set(${_FOUND_VAR} FALSE)
       set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}")
     else()
       set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
     endif()
   endforeach()
-  if(NOT "${${_NAME}_FOUND}" STREQUAL "FALSE")
-    set(${_NAME}_FOUND TRUE)
+  if(NOT "${${_FOUND_VAR}}" STREQUAL "FALSE")
+    set(${_FOUND_VAR} TRUE)
   endif()
 
   # component handling
@@ -257,7 +273,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
         set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}")
 
         if(${_NAME}_FIND_REQUIRED_${comp})
-          set(${_NAME}_FOUND FALSE)
+          set(${_FOUND_VAR} FALSE)
           set(MISSING_VARS "${MISSING_VARS} ${comp}")
         endif()
 
@@ -340,12 +356,12 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
   if(VERSION_OK)
     set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]")
   else()
-    set(${_NAME}_FOUND FALSE)
+    set(${_FOUND_VAR} FALSE)
   endif()
 
 
   # print the result:
-  if (${_NAME}_FOUND)
+  if (${_FOUND_VAR})
     FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG} ${COMPONENT_MSG}" "${DETAILS}")
   else ()
 
@@ -361,6 +377,6 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
 
   endif ()
 
-  set(${_NAME}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
-  set(${_NAME_UPPER}_FOUND ${${_NAME}_FOUND} PARENT_SCOPE)
+  set(${_FOUND_VAR} ${${_FOUND_VAR}} PARENT_SCOPE)
+
 endfunction()
diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt
index 8fafa3b..f311fb9 100644
--- a/Tests/FindPackageTest/CMakeLists.txt
+++ b/Tests/FindPackageTest/CMakeLists.txt
@@ -45,18 +45,12 @@ endif()
 
 find_package(SomePackage)
 if(NOT SomePackage_FOUND)
-  message(SEND_ERROR "SomePackage not found !")
-endif()
-if(NOT SOMEPACKAGE_FOUND)
-  message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
+  message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !")
 endif()
 
 find_package(UpperCasePackage)
-if(NOT UpperCasePackage_FOUND)
-  message(SEND_ERROR "UpperCasePackage not found!")
-endif()
 if(NOT UPPERCASEPACKAGE_FOUND)
-  message(SEND_ERROR "SomePackage compatibility name SOMEPACKAGE_FOUND not set!")
+  message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !")
 endif()
 
 #-----------------------------------------------------------------------------
diff --git a/Tests/FindPackageTest/FindSomePackage.cmake b/Tests/FindPackageTest/FindSomePackage.cmake
index 746c087..7283d24 100644
--- a/Tests/FindPackageTest/FindSomePackage.cmake
+++ b/Tests/FindPackageTest/FindSomePackage.cmake
@@ -2,4 +2,5 @@ set(SOP_FOO TRUE)
 
 include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
 
-find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO)
+find_package_handle_standard_args(SomePackage REQUIRED_VARS SOP_FOO
+                                              FOUND_VAR SomePackage_FOUND )
diff --git a/Tests/FindPackageTest/FindUpperCasePackage.cmake b/Tests/FindPackageTest/FindUpperCasePackage.cmake
index 5e349da..425d417 100644
--- a/Tests/FindPackageTest/FindUpperCasePackage.cmake
+++ b/Tests/FindPackageTest/FindUpperCasePackage.cmake
@@ -2,4 +2,5 @@ set(UCP_FOO TRUE)
 
 include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
 
-find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO)
+find_package_handle_standard_args(UpperCasePackage REQUIRED_VARS UCP_FOO
+                                                   FOUND_VAR UPPERCASEPACKAGE_FOUND )
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-result.txt b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar-result.txt
@@ -0,0 +1 @@
+1
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
new file mode 100644
index 0000000..4c739d8
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
@@ -0,0 +1,7 @@
+CMake Error at .*/Modules/FindPackageHandleStandardArgs.cmake:[0-9]+ \(message\):
+  The argument for FOUND_VAR is "badfoundvar_FOUND", but only
+  "BadFoundVar_FOUND" and "BADFOUNDVAR_FOUND" are valid names.
+Call Stack \(most recent call first\):
+  FindBadFoundVar.cmake:5 \(find_package_handle_standard_args\)
+  BadFoundVar.cmake:3 \(find_package\)
+  CMakeLists.txt:3 \(include\)
diff --git a/Tests/RunCMake/FPHSA/BadFoundVar.cmake b/Tests/RunCMake/FPHSA/BadFoundVar.cmake
new file mode 100644
index 0000000..07d4322
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/BadFoundVar.cmake
@@ -0,0 +1,3 @@
+set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}")
+
+find_package(BadFoundVar REQUIRED)
diff --git a/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake
new file mode 100644
index 0000000..152df5c
--- /dev/null
+++ b/Tests/RunCMake/FPHSA/FindBadFoundVar.cmake
@@ -0,0 +1,6 @@
+set(BFV_FOO TRUE)
+
+include(FindPackageHandleStandardArgs)
+
+find_package_handle_standard_args(BadFoundVar REQUIRED_VARS BFV_FOO
+                                              FOUND_VAR badfoundvar_FOUND )
diff --git a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
index b63cfa7..e9b2a7a 100644
--- a/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FPHSA/RunCMakeTest.cmake
@@ -1,5 +1,7 @@
 include(RunCMake)
 
+run_cmake(BadFoundVar)
+
 # The pseudo module will "find" a package with the given version. Check if the
 # version selection code in FPHSA works correctly.
 set(RunCMake_TEST_OPTIONS "-DCMAKE_MODULE_PATH=${CMAKE_CURRENT_LIST_DIR}" "-DPseudo_VERSION=1.2.3.4.5")

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

Summary of changes:
 Modules/FindPackageHandleStandardArgs.cmake        |   66 ++++++++++++--------
 Tests/FindPackageTest/CMakeLists.txt               |   10 +--
 Tests/FindPackageTest/FindSomePackage.cmake        |    3 +-
 Tests/FindPackageTest/FindUpperCasePackage.cmake   |    3 +-
 .../BadFoundVar-result.txt}                        |    0
 Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt        |    7 +++
 Tests/RunCMake/FPHSA/BadFoundVar.cmake             |    3 +
 Tests/RunCMake/FPHSA/FindBadFoundVar.cmake         |    6 ++
 Tests/RunCMake/FPHSA/RunCMakeTest.cmake            |    2 +
 9 files changed, 65 insertions(+), 35 deletions(-)
 copy Tests/RunCMake/{CMP0004/CMP0004-NEW-result.txt => FPHSA/BadFoundVar-result.txt} (100%)
 create mode 100644 Tests/RunCMake/FPHSA/BadFoundVar-stderr.txt
 create mode 100644 Tests/RunCMake/FPHSA/BadFoundVar.cmake
 create mode 100644 Tests/RunCMake/FPHSA/FindBadFoundVar.cmake


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list