[Cmake-commits] CMake branch, master, updated. v3.9.2-867-g71c752a

Kitware Robot kwrobot at kitware.com
Tue Sep 19 08:25:06 EDT 2017


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  71c752a63b8904de48b3d61535b4fe1ba368d430 (commit)
       via  d947310f173a2652c3b069ade212d548075e4d7b (commit)
       via  a929dd166e16cd7b3aa4c9352faaf3b01bc61101 (commit)
       via  e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4 (commit)
       via  4636c64bfe71ceaad7991dfc3a397b721a578363 (commit)
       via  350617914596a593015f78cf42c7ed894e6a7512 (commit)
       via  9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d (commit)
      from  3be6835ed198253c01e2dbc2e4e0542468bb5be4 (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=71c752a63b8904de48b3d61535b4fe1ba368d430
commit 71c752a63b8904de48b3d61535b4fe1ba368d430
Merge: d947310 e2cca9f
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 19 12:24:08 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Sep 19 08:24:25 2017 -0400

    Merge topic 'gtest-fix-windows-linking'
    
    e2cca9f8 FindGTest: Avoid macro name collision
    4636c64b FindGTest: Improve test to catch link error
    35061791 FindGTest: Fix shared linking on Windows
    9fd9e448 FindGTest: Avoid using find_dependency in a find module
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1267


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d947310f173a2652c3b069ade212d548075e4d7b
commit d947310f173a2652c3b069ade212d548075e4d7b
Merge: 3be6835 a929dd1
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Sep 19 12:13:29 2017 +0000
Commit:     Kitware Robot <kwrobot at kitware.com>
CommitDate: Tue Sep 19 08:15:36 2017 -0400

    Merge topic 'FindBoost-IN_LIST'
    
    a929dd16 FindBoost: Simplify search in lists
    
    Acked-by: Kitware Robot <kwrobot at kitware.com>
    Merge-request: !1281


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=a929dd166e16cd7b3aa4c9352faaf3b01bc61101
commit a929dd166e16cd7b3aa4c9352faaf3b01bc61101
Author:     Alex Turbov <i.zaufi at gmail.com>
AuthorDate: Sun Apr 23 21:30:31 2017 +0700
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Mon Sep 18 13:44:25 2017 -0400

    FindBoost: Simplify search in lists
    
    Instead of `list(FIND...)` and then checking result for `-1`
    (found/not-found), nowadays `if` command has the `IN_LIST` test for
    that.
    
    This change was originally made by commit v3.9.0-rc1~41^2 (FindBoost:
    Simplify search in lists, 2017-04-23) but then had to be reverted by
    commit v3.9.2~3^2 (FindBoost: Revert "Simplify search in lists.",
    2017-09-05) due to problems related to using `find_dependency`.  Those
    problems were addressed by commit 3080a0a611 (FindBoost: Improve
    behavior when thread dependency is missing, 2017-09-15), so now we can
    restore the original change.
    
    Issue: #17252

diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index b3d204b..6d1514d 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -214,6 +214,10 @@
 #
 # Set Boost_NO_BOOST_CMAKE to ON to disable the search for boost-cmake.
 
+# Save project's policies
+cmake_policy(PUSH)
+cmake_policy(SET CMP0057 NEW) # if IN_LIST
+
 #-------------------------------------------------------------------------------
 # Before we go searching, check whether boost-cmake is available, unless the
 # user specifically asked NOT to search for boost-cmake.
@@ -905,9 +909,7 @@ function(_Boost_MISSING_DEPENDENCIES componentvar extravar)
       set(_Boost_${uppercomponent}_DEPENDENCIES ${_Boost_${uppercomponent}_DEPENDENCIES} PARENT_SCOPE)
       set(_Boost_IMPORTED_TARGETS ${_Boost_IMPORTED_TARGETS} PARENT_SCOPE)
       foreach(componentdep ${_Boost_${uppercomponent}_DEPENDENCIES})
-        list(FIND _boost_processed_components "${componentdep}" _boost_component_found)
-        list(FIND _boost_new_components "${componentdep}" _boost_component_new)
-        if (_boost_component_found EQUAL -1 AND _boost_component_new EQUAL -1)
+        if (NOT ("${componentdep}" IN_LIST _boost_processed_components OR "${componentdep}" IN_LIST _boost_new_components))
           list(APPEND _boost_new_components ${componentdep})
         endif()
       endforeach()
@@ -1541,8 +1543,7 @@ endif()
 _Boost_MISSING_DEPENDENCIES(Boost_FIND_COMPONENTS _Boost_EXTRA_FIND_COMPONENTS)
 
 # If thread is required, get the thread libs as a dependency
-list(FIND Boost_FIND_COMPONENTS thread _Boost_THREAD_DEPENDENCY_LIBS)
-if(NOT _Boost_THREAD_DEPENDENCY_LIBS EQUAL -1)
+if("thread" IN_LIST Boost_FIND_COMPONENTS)
   if(Boost_FIND_QUIETLY)
     set(_Boost_find_quiet QUIET)
   else()
@@ -1977,3 +1978,6 @@ list(REMOVE_DUPLICATES _Boost_COMPONENTS_SEARCHED)
 list(SORT _Boost_COMPONENTS_SEARCHED)
 set(_Boost_COMPONENTS_SEARCHED "${_Boost_COMPONENTS_SEARCHED}"
   CACHE INTERNAL "Components requested for this build tree.")
+
+# Restore project's policies
+cmake_policy(POP)

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4
commit e2cca9f8ee04e9c775aee2276dd7122dcabf5dc4
Author:     Matthew Woehlke <matthew.woehlke at kitware.com>
AuthorDate: Fri Sep 15 12:53:16 2017 -0400
Commit:     Matthew Woehlke <matthew.woehlke at kitware.com>
CommitDate: Mon Sep 18 10:01:36 2017 -0400

    FindGTest: Avoid macro name collision
    
    Use two _'s for private function/macro names rather than one. This
    avoids a potential collision if a function/macro with no leading _ that
    otherwise matches the name of a private function/macro also overrides a
    built-in function or is defined twice.

diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 4543857..b0579d9 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -75,7 +75,7 @@
 
 include(${CMAKE_CURRENT_LIST_DIR}/GoogleTest.cmake)
 
-function(_gtest_append_debugs _endvar _library)
+function(__gtest_append_debugs _endvar _library)
     if(${_library} AND ${_library}_DEBUG)
         set(_output optimized ${${_library}} debug ${${_library}_DEBUG})
     else()
@@ -84,7 +84,7 @@ function(_gtest_append_debugs _endvar _library)
     set(${_endvar} ${_output} PARENT_SCOPE)
 endfunction()
 
-function(_gtest_find_library _name)
+function(__gtest_find_library _name)
     find_library(${_name}
         NAMES ${ARGN}
         HINTS
@@ -95,7 +95,7 @@ function(_gtest_find_library _name)
     mark_as_advanced(${_name})
 endfunction()
 
-macro(_gtest_determine_windows_library_type _var)
+macro(__gtest_determine_windows_library_type _var)
     if(EXISTS "${${_var}}")
         file(TO_NATIVE_PATH "${${_var}}" _lib_path)
         get_filename_component(_name "${${_var}}" NAME_WE)
@@ -109,18 +109,18 @@ macro(_gtest_determine_windows_library_type _var)
     endif()
 endmacro()
 
-function(_gtest_determine_library_type _var)
+function(__gtest_determine_library_type _var)
     if(WIN32)
         # For now, at least, only Windows really needs to know the library type
-        _gtest_determine_windows_library_type(${_var})
-        _gtest_determine_windows_library_type(${_var}_RELEASE)
-        _gtest_determine_windows_library_type(${_var}_DEBUG)
+        __gtest_determine_windows_library_type(${_var})
+        __gtest_determine_windows_library_type(${_var}_RELEASE)
+        __gtest_determine_windows_library_type(${_var}_DEBUG)
     endif()
     # If we get here, no determination was made from the above checks
     set(${_var}_TYPE UNKNOWN PARENT_SCOPE)
 endfunction()
 
-function(_gtest_import_library _target _var _config)
+function(__gtest_import_library _target _var _config)
     if(_config)
         set(_config_suffix "_${_config}")
     else()
@@ -181,15 +181,15 @@ mark_as_advanced(GTEST_INCLUDE_DIR)
 if(MSVC AND GTEST_MSVC_SEARCH STREQUAL "MD")
     # The provided /MD project files for Google Test add -md suffixes to the
     # library names.
-    _gtest_find_library(GTEST_LIBRARY            gtest-md  gtest)
-    _gtest_find_library(GTEST_LIBRARY_DEBUG      gtest-mdd gtestd)
-    _gtest_find_library(GTEST_MAIN_LIBRARY       gtest_main-md  gtest_main)
-    _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
+    __gtest_find_library(GTEST_LIBRARY            gtest-md  gtest)
+    __gtest_find_library(GTEST_LIBRARY_DEBUG      gtest-mdd gtestd)
+    __gtest_find_library(GTEST_MAIN_LIBRARY       gtest_main-md  gtest_main)
+    __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_main-mdd gtest_maind)
 else()
-    _gtest_find_library(GTEST_LIBRARY            gtest)
-    _gtest_find_library(GTEST_LIBRARY_DEBUG      gtestd)
-    _gtest_find_library(GTEST_MAIN_LIBRARY       gtest_main)
-    _gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
+    __gtest_find_library(GTEST_LIBRARY            gtest)
+    __gtest_find_library(GTEST_LIBRARY_DEBUG      gtestd)
+    __gtest_find_library(GTEST_MAIN_LIBRARY       gtest_main)
+    __gtest_find_library(GTEST_MAIN_LIBRARY_DEBUG gtest_maind)
 endif()
 
 include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
@@ -197,14 +197,14 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(GTest DEFAULT_MSG GTEST_LIBRARY GTEST_INCLUDE_
 
 if(GTEST_FOUND)
     set(GTEST_INCLUDE_DIRS ${GTEST_INCLUDE_DIR})
-    _gtest_append_debugs(GTEST_LIBRARIES      GTEST_LIBRARY)
-    _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
+    __gtest_append_debugs(GTEST_LIBRARIES      GTEST_LIBRARY)
+    __gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
     set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
 
     find_package(Threads QUIET)
 
     if(NOT TARGET GTest::GTest)
-        _gtest_determine_library_type(GTEST_LIBRARY)
+        __gtest_determine_library_type(GTEST_LIBRARY)
         add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED)
         if(TARGET Threads::Threads)
             set_target_properties(GTest::GTest PROPERTIES
@@ -218,17 +218,17 @@ if(GTEST_FOUND)
             set_target_properties(GTest::GTest PROPERTIES
                 INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
         endif()
-        _gtest_import_library(GTest::GTest GTEST_LIBRARY "")
-        _gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
-        _gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
+        __gtest_import_library(GTest::GTest GTEST_LIBRARY "")
+        __gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
+        __gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
     endif()
     if(NOT TARGET GTest::Main)
-        _gtest_determine_library_type(GTEST_MAIN_LIBRARY)
+        __gtest_determine_library_type(GTEST_MAIN_LIBRARY)
         add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
         set_target_properties(GTest::Main PROPERTIES
             INTERFACE_LINK_LIBRARIES "GTest::GTest")
-        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
-        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
-        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
+        __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
+        __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
+        __gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
     endif()
 endif()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=4636c64bfe71ceaad7991dfc3a397b721a578363
commit 4636c64bfe71ceaad7991dfc3a397b721a578363
Author:     Matthew Woehlke <matthew.woehlke at kitware.com>
AuthorDate: Mon Sep 18 09:58:12 2017 -0400
Commit:     Matthew Woehlke <matthew.woehlke at kitware.com>
CommitDate: Mon Sep 18 10:01:15 2017 -0400

    FindGTest: Improve test to catch link error
    
    Add a reference to one of Google Test's command-line flags to the
    FindGTest test. This will ensure that we are using the correct compile
    definitions on Windows, as the test will otherwise fail to link. (IOW,
    this tests the changes made by the previous commit.)

diff --git a/Tests/FindGTest/Test/main.cxx b/Tests/FindGTest/Test/main.cxx
index 0572a5d..19d2967 100644
--- a/Tests/FindGTest/Test/main.cxx
+++ b/Tests/FindGTest/Test/main.cxx
@@ -2,5 +2,7 @@
 
 TEST(FindCMake, LinksAndRuns)
 {
+  using namespace testing;
+  EXPECT_FALSE(GTEST_FLAG(list_tests));
   ASSERT_TRUE(true);
 }

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=350617914596a593015f78cf42c7ed894e6a7512
commit 350617914596a593015f78cf42c7ed894e6a7512
Author:     Matthew Woehlke <matthew.woehlke at kitware.com>
AuthorDate: Fri Sep 15 10:10:16 2017 -0400
Commit:     Matthew Woehlke <matthew.woehlke at kitware.com>
CommitDate: Mon Sep 18 10:01:13 2017 -0400

    FindGTest: Fix shared linking on Windows
    
    Add logic to FindGTest.cmake to attempt to determine if the libraries
    are shared or static. If the libraries are shared, add an interface
    compile definition that is needed in some cases for successful linking
    on Windows.
    
    See also https://github.com/google/googletest/issues/877.

diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index 889a68d..4543857 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -95,6 +95,56 @@ function(_gtest_find_library _name)
     mark_as_advanced(${_name})
 endfunction()
 
+macro(_gtest_determine_windows_library_type _var)
+    if(EXISTS "${${_var}}")
+        file(TO_NATIVE_PATH "${${_var}}" _lib_path)
+        get_filename_component(_name "${${_var}}" NAME_WE)
+        file(STRINGS "${${_var}}" _match REGEX "${_name}\\.dll" LIMIT_COUNT 1)
+        if(NOT _match STREQUAL "")
+            set(${_var}_TYPE SHARED PARENT_SCOPE)
+        else()
+            set(${_var}_TYPE UNKNOWN PARENT_SCOPE)
+        endif()
+        return()
+    endif()
+endmacro()
+
+function(_gtest_determine_library_type _var)
+    if(WIN32)
+        # For now, at least, only Windows really needs to know the library type
+        _gtest_determine_windows_library_type(${_var})
+        _gtest_determine_windows_library_type(${_var}_RELEASE)
+        _gtest_determine_windows_library_type(${_var}_DEBUG)
+    endif()
+    # If we get here, no determination was made from the above checks
+    set(${_var}_TYPE UNKNOWN PARENT_SCOPE)
+endfunction()
+
+function(_gtest_import_library _target _var _config)
+    if(_config)
+        set(_config_suffix "_${_config}")
+    else()
+        set(_config_suffix "")
+    endif()
+
+    set(_lib "${${_var}${_config_suffix}}")
+    if(EXISTS "${_lib}")
+        if(_config)
+            set_property(TARGET ${_target} APPEND PROPERTY
+                IMPORTED_CONFIGURATIONS ${_config})
+        endif()
+        set_target_properties(${_target} PROPERTIES
+            IMPORTED_LINK_INTERFACE_LANGUAGES${_config_suffix} "CXX")
+        if(WIN32 AND ${_var}_TYPE STREQUAL SHARED)
+            set_target_properties(${_target} PROPERTIES
+                IMPORTED_IMPLIB${_config_suffix} "${_lib}")
+        else()
+            set_target_properties(${_target} PROPERTIES
+                IMPORTED_LOCATION${_config_suffix} "${_lib}")
+        endif()
+    endif()
+endfunction()
+
 #
 
 if(NOT DEFINED GTEST_MSVC_SEARCH)
@@ -154,57 +204,31 @@ if(GTEST_FOUND)
     find_package(Threads QUIET)
 
     if(NOT TARGET GTest::GTest)
-        add_library(GTest::GTest UNKNOWN IMPORTED)
+        _gtest_determine_library_type(GTEST_LIBRARY)
+        add_library(GTest::GTest ${GTEST_LIBRARY_TYPE} IMPORTED)
         if(TARGET Threads::Threads)
             set_target_properties(GTest::GTest PROPERTIES
                 INTERFACE_LINK_LIBRARIES Threads::Threads)
         endif()
-        if(GTEST_INCLUDE_DIRS)
-            set_target_properties(GTest::GTest PROPERTIES
-                INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
-        endif()
-        if(EXISTS "${GTEST_LIBRARY}")
+        if(GTEST_LIBRARY_TYPE STREQUAL "SHARED")
             set_target_properties(GTest::GTest PROPERTIES
-                IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
-                IMPORTED_LOCATION "${GTEST_LIBRARY}")
+                INTERFACE_COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
         endif()
-        if(EXISTS "${GTEST_LIBRARY_RELEASE}")
-            set_property(TARGET GTest::GTest APPEND PROPERTY
-                IMPORTED_CONFIGURATIONS RELEASE)
-            set_target_properties(GTest::GTest PROPERTIES
-                IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
-                IMPORTED_LOCATION_RELEASE "${GTEST_LIBRARY_RELEASE}")
-        endif()
-        if(EXISTS "${GTEST_LIBRARY_DEBUG}")
-            set_property(TARGET GTest::GTest APPEND PROPERTY
-                IMPORTED_CONFIGURATIONS DEBUG)
+        if(GTEST_INCLUDE_DIRS)
             set_target_properties(GTest::GTest PROPERTIES
-                IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
-                IMPORTED_LOCATION_DEBUG "${GTEST_LIBRARY_DEBUG}")
+                INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")
         endif()
-      endif()
-      if(NOT TARGET GTest::Main)
-          add_library(GTest::Main UNKNOWN IMPORTED)
-          set_target_properties(GTest::Main PROPERTIES
-              INTERFACE_LINK_LIBRARIES "GTest::GTest")
-          if(EXISTS "${GTEST_MAIN_LIBRARY}")
-              set_target_properties(GTest::Main PROPERTIES
-                  IMPORTED_LINK_INTERFACE_LANGUAGES "CXX"
-                  IMPORTED_LOCATION "${GTEST_MAIN_LIBRARY}")
-          endif()
-          if(EXISTS "${GTEST_MAIN_LIBRARY_RELEASE}")
-            set_property(TARGET GTest::Main APPEND PROPERTY
-                IMPORTED_CONFIGURATIONS RELEASE)
-            set_target_properties(GTest::Main PROPERTIES
-                IMPORTED_LINK_INTERFACE_LANGUAGES_RELEASE "CXX"
-                IMPORTED_LOCATION_RELEASE "${GTEST_MAIN_LIBRARY_RELEASE}")
-          endif()
-          if(EXISTS "${GTEST_MAIN_LIBRARY_DEBUG}")
-            set_property(TARGET GTest::Main APPEND PROPERTY
-                IMPORTED_CONFIGURATIONS DEBUG)
-            set_target_properties(GTest::Main PROPERTIES
-                IMPORTED_LINK_INTERFACE_LANGUAGES_DEBUG "CXX"
-                IMPORTED_LOCATION_DEBUG "${GTEST_MAIN_LIBRARY_DEBUG}")
-          endif()
+        _gtest_import_library(GTest::GTest GTEST_LIBRARY "")
+        _gtest_import_library(GTest::GTest GTEST_LIBRARY "RELEASE")
+        _gtest_import_library(GTest::GTest GTEST_LIBRARY "DEBUG")
+    endif()
+    if(NOT TARGET GTest::Main)
+        _gtest_determine_library_type(GTEST_MAIN_LIBRARY)
+        add_library(GTest::Main ${GTEST_MAIN_LIBRARY_TYPE} IMPORTED)
+        set_target_properties(GTest::Main PROPERTIES
+            INTERFACE_LINK_LIBRARIES "GTest::GTest")
+        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "")
+        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "RELEASE")
+        _gtest_import_library(GTest::Main GTEST_MAIN_LIBRARY "DEBUG")
     endif()
 endif()

https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d
commit 9fd9e448d0e57fecb1fea2e27c2c89dabc2ad23d
Author:     Matthew Woehlke <matthew.woehlke at kitware.com>
AuthorDate: Thu Sep 14 12:28:26 2017 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Sep 14 14:20:13 2017 -0400

    FindGTest: Avoid using find_dependency in a find module
    
    The `find_dependency` macro is not meant for use in find modules.
    Instead use plain `find_package` for the Threads package.  Assume that
    if it is not found then it isn't needed on the current platform.
    
    Issue: #17257

diff --git a/Modules/FindGTest.cmake b/Modules/FindGTest.cmake
index cb71ef1..889a68d 100644
--- a/Modules/FindGTest.cmake
+++ b/Modules/FindGTest.cmake
@@ -151,13 +151,14 @@ if(GTEST_FOUND)
     _gtest_append_debugs(GTEST_MAIN_LIBRARIES GTEST_MAIN_LIBRARY)
     set(GTEST_BOTH_LIBRARIES ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES})
 
-    include(CMakeFindDependencyMacro)
-    find_dependency(Threads)
+    find_package(Threads QUIET)
 
     if(NOT TARGET GTest::GTest)
         add_library(GTest::GTest UNKNOWN IMPORTED)
-        set_target_properties(GTest::GTest PROPERTIES
-            INTERFACE_LINK_LIBRARIES "Threads::Threads")
+        if(TARGET Threads::Threads)
+            set_target_properties(GTest::GTest PROPERTIES
+                INTERFACE_LINK_LIBRARIES Threads::Threads)
+        endif()
         if(GTEST_INCLUDE_DIRS)
             set_target_properties(GTest::GTest PROPERTIES
                 INTERFACE_INCLUDE_DIRECTORIES "${GTEST_INCLUDE_DIRS}")

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

Summary of changes:
 Modules/FindBoost.cmake       |   14 ++--
 Modules/FindGTest.cmake       |  141 ++++++++++++++++++++++++-----------------
 Tests/FindGTest/Test/main.cxx |    2 +
 3 files changed, 94 insertions(+), 63 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list