[Cmake-commits] CMake branch, master, updated. v3.14.0-500-g9fbad8b

Kitware Robot kwrobot at kitware.com
Mon Mar 25 11:53:19 EDT 2019


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, master has been updated
       via  9fbad8b40be8e915f84f51842d88e97b0c949b2b (commit)
       via  28ef639d2b08c1cbdef20e70f4b30f2841916cc8 (commit)
       via  ba7e44eb7a319d15c7ac18bdf6d15487311a85a2 (commit)
       via  f401a5716025ecafc5c11da322eba25b77abee0c (commit)
       via  4d769419244aadb9742cafb06e704d3aa5cc10bc (commit)
       via  78f23de70c14634db3fcdae4b6cc31f1e43ed3b6 (commit)
      from  e7fb007b615bfc4d7cb0ddfb096225e36c6496e4 (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 -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9fbad8b40be8e915f84f51842d88e97b0c949b2b
commit 9fbad8b40be8e915f84f51842d88e97b0c949b2b
Merge: 28ef639 ba7e44e
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 25 15:52:15 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Mar 25 11:52:25 2019 -0400

    Merge topic 'ctest_submit_get_buildid'
    
    ba7e44eb7a ctest_submit: Add option BUILD_ID
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Acked-by: Zack Galbreath <zack.galbreath at kitware.com>
    Merge-request: !3120


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=28ef639d2b08c1cbdef20e70f4b30f2841916cc8
commit 28ef639d2b08c1cbdef20e70f4b30f2841916cc8
Merge: e7fb007 f401a57
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Mon Mar 25 15:51:18 2019 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Mon Mar 25 11:51:29 2019 -0400

    Merge topic 'pkg-get-variable-prefix-path'
    
    f401a57160 pkg_get_variable now sets PKG_CONFIG_PATH like pkg_check_modules
    4d76941924 FindPkgConfig: hoist PKG_CONFIG_PATH ops out into _pkg_set_path_internal
    78f23de70c More tests for pkg_get_variable
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !3131


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=ba7e44eb7a319d15c7ac18bdf6d15487311a85a2
commit ba7e44eb7a319d15c7ac18bdf6d15487311a85a2
Author:     Zack Galbreath <zack.galbreath at kitware.com>
AuthorDate: Tue Mar 19 11:09:19 2019 -0400
Commit:     Zack Galbreath <zack.galbreath at kitware.com>
CommitDate: Fri Mar 22 09:37:08 2019 -0400

    ctest_submit: Add option BUILD_ID
    
    Fixes: #18968

diff --git a/Help/command/ctest_submit.rst b/Help/command/ctest_submit.rst
index ac9eac1..983fc20 100644
--- a/Help/command/ctest_submit.rst
+++ b/Help/command/ctest_submit.rst
@@ -7,6 +7,7 @@ Perform the :ref:`CTest Submit Step` as a :ref:`Dashboard Client`.
 
   ctest_submit([PARTS <part>...] [FILES <file>...]
                [SUBMIT_URL <url>]
+               [BUILD_ID <result-var>]
                [HTTPHEADER <header>]
                [RETRY_COUNT <count>]
                [RETRY_DELAY <delay>]
@@ -44,6 +45,10 @@ The options are:
   The ``http`` or ``https`` URL of the dashboard server to send the submission
   to.  If not given, the :variable:`CTEST_SUBMIT_URL` variable is used.
 
+``BUILD_ID <result-var>``
+  Store in the ``<result-var>`` variable the ID assigned to this build by
+  CDash.
+
 ``HTTPHEADER <HTTP-header>``
   Specify HTTP header to be included in the request to CDash during submission.
   For example, CDash can be configured to only accept submissions from
@@ -94,5 +99,6 @@ with a content hash of the file. If CDash does not already have the file,
 then it is uploaded. Along with the file, a CDash type string is specified
 to tell CDash which handler to use to process the data.
 
-This signature accepts the ``SUBMIT_URL``, ``HTTPHEADER``, ``RETRY_COUNT``,
-``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options as described above.
+This signature accepts the ``SUBMIT_URL``, ``BUILD_ID``, ``HTTPHEADER``,
+``RETRY_COUNT``, ``RETRY_DELAY``, ``RETURN_VALUE`` and ``QUIET`` options
+as described above.
diff --git a/Help/release/dev/ctest_submit_get_buildid.rst b/Help/release/dev/ctest_submit_get_buildid.rst
new file mode 100644
index 0000000..39a0010
--- /dev/null
+++ b/Help/release/dev/ctest_submit_get_buildid.rst
@@ -0,0 +1,6 @@
+ctest_submit_get_buildid
+--------------------------
+
+* The :command:`ctest_submit` command learned a new option: ``BUILD_ID``.
+  This can be used to store the ID assigned to this build by CDash to a
+  variable.
diff --git a/Source/CTest/cmCTestSubmitCommand.cxx b/Source/CTest/cmCTestSubmitCommand.cxx
index e31d982..afc3e67 100644
--- a/Source/CTest/cmCTestSubmitCommand.cxx
+++ b/Source/CTest/cmCTestSubmitCommand.cxx
@@ -12,6 +12,29 @@
 
 class cmExecutionStatus;
 
+cmCTestSubmitCommand::cmCTestSubmitCommand()
+{
+  this->PartsMentioned = false;
+  this->FilesMentioned = false;
+  this->InternalTest = false;
+  this->RetryCount = "";
+  this->RetryDelay = "";
+  this->CDashUpload = false;
+  this->Arguments[cts_BUILD_ID] = "BUILD_ID";
+  this->Last = cts_LAST;
+}
+
+/**
+ * This is a virtual constructor for the command.
+ */
+cmCommand* cmCTestSubmitCommand::Clone()
+{
+  cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
+  ni->CTest = this->CTest;
+  ni->CTestScriptHandler = this->CTestScriptHandler;
+  return ni;
+}
+
 cmCTestGenericHandler* cmCTestSubmitCommand::InitializeHandler()
 {
   const char* submitURL = !this->SubmitURL.empty()
@@ -111,7 +134,15 @@ bool cmCTestSubmitCommand::InitialPass(std::vector<std::string> const& args,
                                        cmExecutionStatus& status)
 {
   this->CDashUpload = !args.empty() && args[0] == "CDASH_UPLOAD";
-  return this->cmCTestHandlerCommand::InitialPass(args, status);
+
+  bool ret = this->cmCTestHandlerCommand::InitialPass(args, status);
+
+  if (this->Values[cts_BUILD_ID] && *this->Values[cts_BUILD_ID]) {
+    this->Makefile->AddDefinition(this->Values[cts_BUILD_ID],
+                                  this->CTest->GetBuildID().c_str());
+  }
+
+  return ret;
 }
 
 bool cmCTestSubmitCommand::CheckArgumentKeyword(std::string const& arg)
diff --git a/Source/CTest/cmCTestSubmitCommand.h b/Source/CTest/cmCTestSubmitCommand.h
index 4b1bb26..1e27046 100644
--- a/Source/CTest/cmCTestSubmitCommand.h
+++ b/Source/CTest/cmCTestSubmitCommand.h
@@ -25,26 +25,8 @@ class cmExecutionStatus;
 class cmCTestSubmitCommand : public cmCTestHandlerCommand
 {
 public:
-  cmCTestSubmitCommand()
-  {
-    this->PartsMentioned = false;
-    this->FilesMentioned = false;
-    this->InternalTest = false;
-    this->RetryCount = "";
-    this->RetryDelay = "";
-    this->CDashUpload = false;
-  }
-
-  /**
-   * This is a virtual constructor for the command.
-   */
-  cmCommand* Clone() override
-  {
-    cmCTestSubmitCommand* ni = new cmCTestSubmitCommand;
-    ni->CTest = this->CTest;
-    ni->CTestScriptHandler = this->CTestScriptHandler;
-    return ni;
-  }
+  cmCTestSubmitCommand();
+  cmCommand* Clone() override;
 
   bool InitialPass(std::vector<std::string> const& args,
                    cmExecutionStatus& status) override;
@@ -75,6 +57,12 @@ protected:
     ArgumentDoingLast2
   };
 
+  enum
+  {
+    cts_BUILD_ID = ct_LAST,
+    cts_LAST
+  };
+
   bool PartsMentioned;
   std::set<cmCTest::Part> Parts;
   bool FilesMentioned;
diff --git a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
index 4d7d29b..78856b4 100644
--- a/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ctest_submit/RunCMakeTest.cmake
@@ -31,7 +31,7 @@ run_ctest_submit(CDashUploadNone CDASH_UPLOAD)
 run_ctest_submit(CDashUploadMissingFile CDASH_UPLOAD bad-upload)
 run_ctest_submit(CDashUploadRetry CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo RETRY_COUNT 2 RETRY_DELAY 1 INTERNAL_TEST_CHECKSUM)
 run_ctest_submit(CDashSubmitQuiet QUIET)
-run_ctest_submit_debug(CDashSubmitVerbose)
+run_ctest_submit_debug(CDashSubmitVerbose BUILD_ID my_build_id)
 run_ctest_submit_debug(FILESNoBuildId FILES ${CMAKE_CURRENT_LIST_FILE})
 run_ctest_submit_debug(CDashSubmitHeaders HTTPHEADER "Authorization: Bearer asdf")
 run_ctest_submit_debug(CDashUploadHeaders CDASH_UPLOAD ${CMAKE_CURRENT_LIST_FILE} CDASH_UPLOAD_TYPE foo HTTPHEADER "Authorization: Bearer asdf")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=f401a5716025ecafc5c11da322eba25b77abee0c
commit f401a5716025ecafc5c11da322eba25b77abee0c
Author:     Dan Kegel <dank at kegel.com>
AuthorDate: Thu Dec 7 10:00:39 2017 -0800
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Mar 20 17:21:47 2019 -0400

    pkg_get_variable now sets PKG_CONFIG_PATH like pkg_check_modules
    
    Fixes: #15805

diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index c852aaa..e05d5c8 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -84,26 +84,8 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
   endif()
 endmacro()
 
-#[========================================[.rst:
-.. command:: pkg_get_variable
-
-  Retrieves the value of a pkg-config variable ``varName`` and stores it in the
-  result variable ``resultVar`` in the calling scope.
-
-  .. code-block:: cmake
-
-    pkg_get_variable(<resultVar> <moduleName> <varName>)
-
-  If ``pkg-config`` returns multiple values for the specified variable,
-  ``resultVar`` will contain a :ref:`;-list <CMake Language Lists>`.
-
-  For example:
-
-  .. code-block:: cmake
-
-    pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
-#]========================================]
-function (pkg_get_variable result pkg variable)
+# Internal version of pkg_get_variable; expects PKG_CONFIG_PATH to already be set
+function (_pkg_get_variable result pkg variable)
   _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
   set("${result}"
     "${prefix_result}"
@@ -294,12 +276,12 @@ macro(_pkg_set_path_internal)
     _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
   endif()
 
-  if(NOT "${_extra_paths}" STREQUAL "")
+  if(NOT _extra_paths STREQUAL "")
     # Save the PKG_CONFIG_PATH environment variable, and add paths
     # from the CMAKE_PREFIX_PATH variables
     set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}")
     set(_pkgconfig_path "${_pkgconfig_path_old}")
-    if(NOT "${_pkgconfig_path}" STREQUAL "")
+    if(NOT _pkgconfig_path STREQUAL "")
       file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
     endif()
 
@@ -347,7 +329,7 @@ macro(_pkg_set_path_internal)
     endforeach()
 
     # Prepare and set the environment variable
-    if(NOT "${_pkgconfig_path}" STREQUAL "")
+    if(NOT _pkgconfig_path STREQUAL "")
       # remove empty values from the list
       list(REMOVE_ITEM _pkgconfig_path "")
       file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
@@ -365,7 +347,7 @@ macro(_pkg_set_path_internal)
 endmacro()
 
 macro(_pkg_restore_path_internal)
-  if(NOT "${_extra_paths}" STREQUAL "")
+  if(NOT _extra_paths STREQUAL "")
     # Restore the environment variable
     set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}")
   endif()
@@ -721,6 +703,34 @@ macro(pkg_search_module _prefix _module0)
   endif()
 endmacro()
 
+#[========================================[.rst:
+.. command:: pkg_get_variable
+
+  Retrieves the value of a pkg-config variable ``varName`` and stores it in the
+  result variable ``resultVar`` in the calling scope.
+
+  .. code-block:: cmake
+
+    pkg_get_variable(<resultVar> <moduleName> <varName>)
+
+  If ``pkg-config`` returns multiple values for the specified variable,
+  ``resultVar`` will contain a :ref:`;-list <CMake Language Lists>`.
+
+  For example:
+
+  .. code-block:: cmake
+
+    pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
+#]========================================]
+function (pkg_get_variable result pkg variable)
+  _pkg_set_path_internal()
+  _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}")
+  set("${result}"
+    "${prefix_result}"
+    PARENT_SCOPE)
+  _pkg_restore_path_internal()
+endfunction ()
+
 
 #[========================================[.rst:
 Variables Affecting Behavior
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index a8340f9..414d9b6 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -14,8 +14,7 @@ endif()
 find_package(PkgConfig)
 if (PKG_CONFIG_FOUND)
   run_cmake(FindPkgConfig_GET_VARIABLE)
-  # Disable this one until https://gitlab.kitware.com/cmake/cmake/issues/15805 fixed
-  #run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH)
+  run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH)
   run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH)
   run_cmake(FindPkgConfig_cache_variables)
   run_cmake(FindPkgConfig_IMPORTED_TARGET)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4d769419244aadb9742cafb06e704d3aa5cc10bc
commit 4d769419244aadb9742cafb06e704d3aa5cc10bc
Author:     Dan Kegel <dank at kegel.com>
AuthorDate: Thu Dec 7 09:38:11 2017 -0800
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Mar 20 17:20:30 2019 -0400

    FindPkgConfig: hoist PKG_CONFIG_PATH ops out into _pkg_set_path_internal

diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index cf0ae09..c852aaa 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -279,6 +279,102 @@ macro(_pkg_recalculate _prefix _no_cmake_path _no_cmake_environment_path _imp_ta
 endmacro()
 
 ###
+macro(_pkg_set_path_internal)
+  set(_extra_paths)
+
+  if(NOT _no_cmake_path)
+    _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
+    _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
+    _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
+  endif()
+
+  if(NOT _no_cmake_environment_path)
+    _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
+    _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
+    _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
+  endif()
+
+  if(NOT "${_extra_paths}" STREQUAL "")
+    # Save the PKG_CONFIG_PATH environment variable, and add paths
+    # from the CMAKE_PREFIX_PATH variables
+    set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}")
+    set(_pkgconfig_path "${_pkgconfig_path_old}")
+    if(NOT "${_pkgconfig_path}" STREQUAL "")
+      file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+    endif()
+
+    # Create a list of the possible pkgconfig subfolder (depending on
+    # the system
+    set(_lib_dirs)
+    if(NOT DEFINED CMAKE_SYSTEM_NAME
+        OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+            AND NOT CMAKE_CROSSCOMPILING))
+      if(EXISTS "/etc/debian_version") # is this a debian system ?
+        if(CMAKE_LIBRARY_ARCHITECTURE)
+          list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+        endif()
+      else()
+        # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties
+        get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS)
+        if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
+          list(APPEND _lib_dirs "lib32/pkgconfig")
+        endif()
+        get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+        if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
+          list(APPEND _lib_dirs "lib64/pkgconfig")
+        endif()
+        get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS)
+        if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32")
+          list(APPEND _lib_dirs "libx32/pkgconfig")
+        endif()
+      endif()
+    endif()
+    if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING)
+      list(APPEND _lib_dirs "libdata/pkgconfig")
+    endif()
+    list(APPEND _lib_dirs "lib/pkgconfig")
+    list(APPEND _lib_dirs "share/pkgconfig")
+
+    # Check if directories exist and eventually append them to the
+    # pkgconfig path list
+    foreach(_prefix_dir ${_extra_paths})
+      foreach(_lib_dir ${_lib_dirs})
+        if(EXISTS "${_prefix_dir}/${_lib_dir}")
+          list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+          list(REMOVE_DUPLICATES _pkgconfig_path)
+        endif()
+      endforeach()
+    endforeach()
+
+    # Prepare and set the environment variable
+    if(NOT "${_pkgconfig_path}" STREQUAL "")
+      # remove empty values from the list
+      list(REMOVE_ITEM _pkgconfig_path "")
+      file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+      if(UNIX)
+        string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+        string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
+      endif()
+      set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}")
+    endif()
+
+    # Unset variables
+    unset(_lib_dirs)
+    unset(_pkgconfig_path)
+  endif()
+endmacro()
+
+macro(_pkg_restore_path_internal)
+  if(NOT "${_extra_paths}" STREQUAL "")
+    # Restore the environment variable
+    set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}")
+  endif()
+
+  unset(_extra_paths)
+  unset(_pkgconfig_path_old)
+endmacro()
+
+###
 macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix)
   _pkgconfig_unset(${_prefix}_FOUND)
   _pkgconfig_unset(${_prefix}_VERSION)
@@ -318,88 +414,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
     set(_pkg_check_modules_packages)
     set(_pkg_check_modules_failed)
 
-    set(_extra_paths)
-
-    if(NOT _no_cmake_path)
-      _pkgconfig_add_extra_path(_extra_paths CMAKE_PREFIX_PATH)
-      _pkgconfig_add_extra_path(_extra_paths CMAKE_FRAMEWORK_PATH)
-      _pkgconfig_add_extra_path(_extra_paths CMAKE_APPBUNDLE_PATH)
-    endif()
-
-    if(NOT _no_cmake_environment_path)
-      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_PREFIX_PATH)
-      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_FRAMEWORK_PATH)
-      _pkgconfig_add_extra_path(_extra_paths ENV CMAKE_APPBUNDLE_PATH)
-    endif()
-
-    if(NOT "${_extra_paths}" STREQUAL "")
-      # Save the PKG_CONFIG_PATH environment variable, and add paths
-      # from the CMAKE_PREFIX_PATH variables
-      set(_pkgconfig_path_old "$ENV{PKG_CONFIG_PATH}")
-      set(_pkgconfig_path "${_pkgconfig_path_old}")
-      if(NOT "${_pkgconfig_path}" STREQUAL "")
-        file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
-      endif()
-
-      # Create a list of the possible pkgconfig subfolder (depending on
-      # the system
-      set(_lib_dirs)
-      if(NOT DEFINED CMAKE_SYSTEM_NAME
-          OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
-              AND NOT CMAKE_CROSSCOMPILING))
-        if(EXISTS "/etc/debian_version") # is this a debian system ?
-          if(CMAKE_LIBRARY_ARCHITECTURE)
-            list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
-          endif()
-        else()
-          # not debian, check the FIND_LIBRARY_USE_LIB32_PATHS and FIND_LIBRARY_USE_LIB64_PATHS properties
-          get_property(uselib32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB32_PATHS)
-          if(uselib32 AND CMAKE_SIZEOF_VOID_P EQUAL 4)
-            list(APPEND _lib_dirs "lib32/pkgconfig")
-          endif()
-          get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
-          if(uselib64 AND CMAKE_SIZEOF_VOID_P EQUAL 8)
-            list(APPEND _lib_dirs "lib64/pkgconfig")
-          endif()
-          get_property(uselibx32 GLOBAL PROPERTY FIND_LIBRARY_USE_LIBX32_PATHS)
-          if(uselibx32 AND CMAKE_INTERNAL_PLATFORM_ABI STREQUAL "ELF X32")
-            list(APPEND _lib_dirs "libx32/pkgconfig")
-          endif()
-        endif()
-      endif()
-      if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND NOT CMAKE_CROSSCOMPILING)
-        list(APPEND _lib_dirs "libdata/pkgconfig")
-      endif()
-      list(APPEND _lib_dirs "lib/pkgconfig")
-      list(APPEND _lib_dirs "share/pkgconfig")
-
-      # Check if directories exist and eventually append them to the
-      # pkgconfig path list
-      foreach(_prefix_dir ${_extra_paths})
-        foreach(_lib_dir ${_lib_dirs})
-          if(EXISTS "${_prefix_dir}/${_lib_dir}")
-            list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
-            list(REMOVE_DUPLICATES _pkgconfig_path)
-          endif()
-        endforeach()
-      endforeach()
-
-      # Prepare and set the environment variable
-      if(NOT "${_pkgconfig_path}" STREQUAL "")
-        # remove empty values from the list
-        list(REMOVE_ITEM _pkgconfig_path "")
-        file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
-        if(UNIX)
-          string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
-          string(REPLACE "\\ " " " _pkgconfig_path "${_pkgconfig_path}")
-        endif()
-        set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path}")
-      endif()
-
-      # Unset variables
-      unset(_lib_dirs)
-      unset(_pkgconfig_path)
-    endif()
+    _pkg_set_path_internal()
 
     # iterate through module list and check whether they exist and match the required version
     foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
@@ -502,13 +517,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma
       _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global})
     endif()
 
-    if(NOT "${_extra_paths}" STREQUAL "")
-      # Restore the environment variable
-      set(ENV{PKG_CONFIG_PATH} "${_pkgconfig_path_old}")
-    endif()
-
-    unset(_extra_paths)
-    unset(_pkgconfig_path_old)
+    _pkg_restore_path_internal()
   else()
     if (${_is_required})
       message(SEND_ERROR "pkg-config tool not found")

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=78f23de70c14634db3fcdae4b6cc31f1e43ed3b6
commit 78f23de70c14634db3fcdae4b6cc31f1e43ed3b6
Author:     Dan Kegel <dank at kegel.com>
AuthorDate: Thu Dec 7 08:00:14 2017 -0800
Commit:     Ben Boeckel <ben.boeckel at kitware.com>
CommitDate: Wed Mar 20 17:18:01 2019 -0400

    More tests for pkg_get_variable
    
    Issue: #15805

diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH.cmake
new file mode 100644
index 0000000..f5f5c8c
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH.cmake
@@ -0,0 +1,21 @@
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH FALSE)
+if(WIN32)
+    set(ENV{CMAKE_PREFIX_PATH} "C:\\baz")
+    set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bletch\\lib\\pkgconfig;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem")
+else()
+    set(ENV{CMAKE_PREFIX_PATH} "/baz")
+    set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bletch/lib/pkgconfig:/this/directory/should/not/exist/in/the/filesystem")
+endif()
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(BLETCH QUIET bletch)
+
+if (NOT BLETCH_FOUND)
+  message(FATAL_ERROR "Failed to find embedded package bletch via PKG_CONFIG_PATH")
+endif ()
+
+pkg_get_variable(bletchvar bletch jackpot)
+if (NOT bletchvar STREQUAL "bletch-lives")
+  message(FATAL_ERROR "Failed to fetch variable jackpot from embedded package bletch via PKG_CONFIG_PATH")
+endif ()
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PREFIX_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PREFIX_PATH.cmake
new file mode 100644
index 0000000..cfc0760
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PREFIX_PATH.cmake
@@ -0,0 +1,21 @@
+# Prepare environment and variables
+set(PKG_CONFIG_USE_CMAKE_PREFIX_PATH TRUE)
+if(WIN32)
+    set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}\\pc-bletch;X:\\this\\directory\\should\\not\\exist\\in\\the\\filesystem")
+    set(ENV{PKG_CONFIG_PATH} "C:\\baz")
+else()
+    set(ENV{CMAKE_PREFIX_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/pc-bletch:/this/directory/should/not/exist/in/the/filesystem")
+    set(ENV{PKG_CONFIG_PATH} "/baz")
+endif()
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(BLETCH QUIET bletch)
+
+if (NOT BLETCH_FOUND)
+  message(FATAL_ERROR "Failed to find embedded package bletch via CMAKE_PREFIX_PATH")
+endif ()
+
+pkg_get_variable(bletchvar bletch jackpot)
+if (NOT bletchvar STREQUAL "bletch-lives")
+  message(FATAL_ERROR "Failed to fetch variable jackpot from embedded package bletch via CMAKE_PREFIX_PATH")
+endif ()
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index 671ff51..a8340f9 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -14,6 +14,9 @@ endif()
 find_package(PkgConfig)
 if (PKG_CONFIG_FOUND)
   run_cmake(FindPkgConfig_GET_VARIABLE)
+  # Disable this one until https://gitlab.kitware.com/cmake/cmake/issues/15805 fixed
+  #run_cmake(FindPkgConfig_GET_VARIABLE_PREFIX_PATH)
+  run_cmake(FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH)
   run_cmake(FindPkgConfig_cache_variables)
   run_cmake(FindPkgConfig_IMPORTED_TARGET)
   run_cmake(FindPkgConfig_VERSION_OPERATORS)
diff --git a/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc
new file mode 100644
index 0000000..04d2c1b
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc
@@ -0,0 +1,12 @@
+prefix=/opt/bletch
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+jackpot=bletch-lives
+
+Name: Bletch
+Description: Dummy packaget to test variable support
+Version: 1.0
+Libs: -L${libdir} -lbletch
+Cflags: -Dbletch_version=1

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

Summary of changes:
 Help/command/ctest_submit.rst                      |  10 +-
 Help/release/dev/ctest_submit_get_buildid.rst      |   6 +
 Modules/FindPkgConfig.cmake                        | 237 +++++++++++----------
 Source/CTest/cmCTestSubmitCommand.cxx              |  33 ++-
 Source/CTest/cmCTestSubmitCommand.h                |  28 +--
 ...FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH.cmake |  21 ++
 .../FindPkgConfig_GET_VARIABLE_PREFIX_PATH.cmake   |  21 ++
 Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake    |   2 +
 .../pc-bletch/lib/pkgconfig/bletch.pc              |  12 ++
 Tests/RunCMake/ctest_submit/RunCMakeTest.cmake     |   2 +-
 10 files changed, 239 insertions(+), 133 deletions(-)
 create mode 100644 Help/release/dev/ctest_submit_get_buildid.rst
 create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PKGCONFIG_PATH.cmake
 create mode 100644 Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE_PREFIX_PATH.cmake
 create mode 100644 Tests/RunCMake/FindPkgConfig/pc-bletch/lib/pkgconfig/bletch.pc


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list