From 0aa91c5c45b99851a636ca45469e146561a250f5 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 10:47:57 -0600 Subject: [PATCH 01/15] Add a basic sync_queue class. --- src/popsift/common/sync_queue.h | 49 +++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 src/popsift/common/sync_queue.h diff --git a/src/popsift/common/sync_queue.h b/src/popsift/common/sync_queue.h new file mode 100644 index 00000000..676261d3 --- /dev/null +++ b/src/popsift/common/sync_queue.h @@ -0,0 +1,49 @@ +#pragma once + +#include +#include +#include + +namespace popsift { + +/************************************************************* + * SyncQueue + * This is a basic alternative to the Boost sync_queue class. + * It lets threads push and pull items off a queue in a thread + * safe manner. + *************************************************************/ +template +class SyncQueue { + public: + SyncQueue() = default; + + /* Push an item onto the queue and signal it's available. */ + void push(const T& value) { + std::unique_lock lock(mtx_); + items_.push(value); + lock.unlock(); + signal_.notify_one(); + } + + /* Check if the queue is empty - thread safety via mutex. */ + bool empty() { + std::unique_lock lock(mtx_); + return items_.empty(); + } + + /* BLOCKING. Pull an item off the queue, or, wait until one arrives. */ + T pull() { + std::unique_lock lock(mtx_); + signal_.wait(lock, [this] { return !items_.empty(); }); + auto ans = items_.front(); + items_.pop(); + return ans; + } + + private: + std::mutex mtx_; + std::queue items_; + std::condition_variable signal_; +}; + +} // namespace popsift \ No newline at end of file From e979663928bf24ac77129e27ad3c611f01d23d06 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 10:48:34 -0600 Subject: [PATCH 02/15] Replace boost::sync_queue and boost::thread with SyncQueue and std::thread. --- src/popsift/popsift.cpp | 12 +++++++----- src/popsift/popsift.h | 14 +++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/popsift/popsift.cpp b/src/popsift/popsift.cpp index 29b7dc6b..95303793 100755 --- a/src/popsift/popsift.cpp +++ b/src/popsift/popsift.cpp @@ -5,6 +5,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#include +#include #include #include "popsift.h" @@ -29,11 +31,11 @@ PopSift::PopSift( const popsift::Config& config, popsift::Config::ProcessingMode configure( config, true ); - _pipe._thread_stage1.reset( new boost::thread( &PopSift::uploadImages, this )); + _pipe._thread_stage1.reset( new std::thread( &PopSift::uploadImages, this )); if( mode == popsift::Config::ExtractingMode ) - _pipe._thread_stage2.reset( new boost::thread( &PopSift::extractDownloadLoop, this )); + _pipe._thread_stage2.reset( new std::thread( &PopSift::extractDownloadLoop, this )); else - _pipe._thread_stage2.reset( new boost::thread( &PopSift::matchPrepareLoop, this )); + _pipe._thread_stage2.reset( new std::thread( &PopSift::matchPrepareLoop, this )); } PopSift::PopSift( ImageMode imode ) @@ -50,8 +52,8 @@ PopSift::PopSift( ImageMode imode ) _pipe._unused.push( new popsift::ImageFloat ); } - _pipe._thread_stage1.reset( new boost::thread( &PopSift::uploadImages, this )); - _pipe._thread_stage2.reset( new boost::thread( &PopSift::extractDownloadLoop, this )); + _pipe._thread_stage1.reset( new std::thread( &PopSift::uploadImages, this )); + _pipe._thread_stage2.reset( new std::thread( &PopSift::extractDownloadLoop, this )); } PopSift::~PopSift() diff --git a/src/popsift/popsift.h b/src/popsift/popsift.h index 93bfa6e2..08fd51b8 100755 --- a/src/popsift/popsift.h +++ b/src/popsift/popsift.h @@ -12,9 +12,9 @@ #include #include #include -#include -#include +#include +#include "common/sync_queue.h" #include "sift_conf.h" #include "sift_extremum.h" @@ -74,11 +74,11 @@ class PopSift { struct Pipe { - std::unique_ptr _thread_stage1; - std::unique_ptr _thread_stage2; - boost::sync_queue _queue_stage1; - boost::sync_queue _queue_stage2; - boost::sync_queue _unused; + std::unique_ptr _thread_stage1; + std::unique_ptr _thread_stage2; + popsift::SyncQueue _queue_stage1; + popsift::SyncQueue _queue_stage2; + popsift::SyncQueue _unused; popsift::Pyramid* _pyramid{nullptr}; From 6fc334ec46082733b60fd595a7019f7484dd886f Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 10:59:04 -0600 Subject: [PATCH 03/15] Isolate the boost requirements in src/application. --- CMakeLists.txt | 13 +------------ src/application/CMakeLists.txt | 5 +++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 72514f25..a5a86022 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,13 +10,9 @@ OPTION(PopSift_USE_POSITION_INDEPENDENT_CODE "Generate position independent code OPTION(PopSift_USE_GRID_FILTER "Switch off grid filtering to massively reduce compile time while debugging other things." ON) OPTION(PopSift_USE_NORMF "The __normf function computes Euclidian distance on large arrays. Fast but stability is uncertain." OFF) OPTION(PopSift_USE_TEST_CMD "Add testing step for functional verification" OFF) -OPTION(PopSift_BOOST_USE_STATIC_LIBS "Link with static Boost libraries" OFF) +OPTION(PopSift_BOOST_USE_STATIC_LIBS "Link examples with static Boost libraries" OFF) OPTION(PopSift_NVCC_WARNINGS "Switch on several additional warning for CUDA nvcc" OFF) -if(PopSift_BOOST_USE_STATIC_LIBS) - set(Boost_USE_STATIC_LIBS ON) -endif() - if(PopSift_USE_POSITION_INDEPENDENT_CODE) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() @@ -40,13 +36,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) # set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -G") # set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -G") -find_package(Boost 1.53.0 REQUIRED COMPONENTS system thread) -if(WIN32) - add_definitions("-DBOOST_ALL_NO_LIB") - link_directories(Boost_LIBRARRY_DIR_DEBUG) - link_directories(Boost_LIBRARRY_DIR_RELEASE) -endif(WIN32) - if(BUILD_SHARED_LIBS) message(STATUS "BUILD_SHARED_LIBS ON") # Need to declare CUDA_USE_STATIC_CUDA_RUNTIME as an option to ensure that it is not overwritten in FindCUDA. diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index 621a3d4e..34433c57 100755 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -14,8 +14,9 @@ endif() find_package(DevIL COMPONENTS IL ILU) # yields IL_FOUND, IL_LIBRARIES, IL_INCLUDE_DIR -set(Boost_INCLUDE_DIRS "") -set(Boost_LIBRARIES "") +if(PopSift_BOOST_USE_STATIC_LIBS) + set(Boost_USE_STATIC_LIBS ON) +endif() find_package(Boost 1.53.0 REQUIRED COMPONENTS filesystem program_options) set(PD_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) From 20525291a4d3c3edaf0e5fb2e2657d97d9482afc Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 11:03:19 -0600 Subject: [PATCH 04/15] Munge with the README to reflect changes to the boost requirement. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 6498e009..b4147bc9 100644 --- a/README.md +++ b/README.md @@ -10,16 +10,16 @@ Dependencies Most of the dependencies can be installed from the common repositories (apt, yum etc): -Boost >= 1.55 ([atomic, chrono, date-time, system, thread]-dev) +Boost >= 1.55 ([atomic, chrono, date-time, system, thread]-dev) (only required for the application) CUDA >= 7.0 DevIL (libdevil-dev) (only required for the application) Build ----- -PopSift has been developed and tested on Linux machines, mostly a variant of Ubuntu, but compiles on MacOSX as well. It comes as a CMake project and requires at least CUDA 7.0 and Boost >= 1.55. It is known to compile and work with NVidia cards of compute capability 3.0 (including the GT 650M), but the code is developed with the compute capability 5.2 card GTX 980 Ti in mind. +PopSift has been developed and tested on Linux machines, mostly a variant of Ubuntu, but compiles on MacOSX as well. It comes as a CMake project and requires at least CUDA 7.0. The example application carries an additional dependency on Boost >= 1.55. It is known to compile and work with NVidia cards of compute capability 3.0 (including the GT 650M), but the code is developed with the compute capability 5.2 card GTX 980 Ti in mind. -If you want to avoid building the application you can run cmake with the option `-DPopSift_BUILD_EXAMPLES:BOOL=OFF`. +If you want to avoid building the example application you can run cmake with the option `-DPopSift_BUILD_EXAMPLES:BOOL=OFF`. If you want to build PopSift as a shared library: `-DBUILD_SHARED_LIBS=ON`. In order to build the library you can run: From 6586b54b769bf46a1d629390dafd92ba09dd962f Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 12:05:18 -0600 Subject: [PATCH 05/15] Remove boost link/include from popsift. --- src/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d636cbb4..5c1bc3e1 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,6 +1,6 @@ set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) -CUDA_INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR}/popsift) +CUDA_INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}/popsift) CUDA_ADD_LIBRARY(popsift popsift/popsift.cpp popsift/popsift.h @@ -49,7 +49,7 @@ configure_file(popsift/sift_config.h.in # BUILD_INTERFACE allows to include the directory with source only when target is # built in the building tree (ie, not from an install location) target_include_directories(popsift - PUBLIC ${Boost_INCLUDE_DIRS} ${CUDA_INCLUDE_DIRS} + PUBLIC ${CUDA_INCLUDE_DIRS} "$") @@ -58,7 +58,7 @@ set_target_properties(popsift PROPERTIES DEBUG_POSTFIX "d") # cannot use PRIVATE here as there is a bug in FindCUDA and CUDA_ADD_LIBRARY # https://gitlab.kitware.com/cmake/cmake/issues/16097 -target_link_libraries(popsift ${Boost_LIBRARIES} ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) +target_link_libraries(popsift ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) # EXPORTING THE LIBRARY From 3a58df9e2cd47b69104239016d4428ecbe055f6c Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 12:05:46 -0600 Subject: [PATCH 06/15] Ignore the reference.tgz that's created by a test. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 722c38cc..c44a8393 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ oxford # Temporary files .DS_Store +# Downloaded archives for tests. +*.tgz From 3b469ca560a35823cb59f40736ba21cc2ee97070 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 13:13:57 -0600 Subject: [PATCH 07/15] Also link to the threads library. --- src/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5c1bc3e1..abc49a81 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -60,6 +60,10 @@ set_target_properties(popsift PROPERTIES DEBUG_POSTFIX "d") # https://gitlab.kitware.com/cmake/cmake/issues/16097 target_link_libraries(popsift ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) +# Link to threads because we're using C++11 std::thread. +find_package(Threads REQUIRED) +target_link_libraries(popsift ${CMAKE_THREAD_LIBS_INIT}) + # EXPORTING THE LIBRARY # From 1793247f55e76d6d3cb0d8b26f0a8be28fc9fc58 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 13:44:56 -0600 Subject: [PATCH 08/15] Add the boost system component; reintroduce win32 condition. --- src/application/CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index 34433c57..b2203379 100755 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -17,7 +17,12 @@ find_package(DevIL COMPONENTS IL ILU) # yields IL_FOUND, IL_LIBRARIES, IL_INCLUD if(PopSift_BOOST_USE_STATIC_LIBS) set(Boost_USE_STATIC_LIBS ON) endif() -find_package(Boost 1.53.0 REQUIRED COMPONENTS filesystem program_options) +find_package(Boost 1.53.0 REQUIRED COMPONENTS filesystem program_options system) +if(WIN32) + add_definitions("-DBOOST_ALL_NO_LIB") + link_directories(Boost_LIBRARRY_DIR_DEBUG) + link_directories(Boost_LIBRARRY_DIR_RELEASE) +endif(WIN32) set(PD_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) set(PD_LINK_LIBS ${Boost_LIBRARIES} ${CUDA_CUDADEVRT_LIBRARY}) From f88f56d7356cd46fcc861a06aa4312e57486dfc5 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 16:46:21 -0600 Subject: [PATCH 09/15] Add doxygen comments to SyncQueue. --- src/popsift/common/sync_queue.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/src/popsift/common/sync_queue.h b/src/popsift/common/sync_queue.h index 676261d3..d8dfcbdf 100644 --- a/src/popsift/common/sync_queue.h +++ b/src/popsift/common/sync_queue.h @@ -6,18 +6,19 @@ namespace popsift { -/************************************************************* - * SyncQueue - * This is a basic alternative to the Boost sync_queue class. - * It lets threads push and pull items off a queue in a thread - * safe manner. - *************************************************************/ +/** + * @brief A thread safe wrapper around std::queue (replaces boost::sync_queue). + * @tparam T the value type that's stored in the queue. + */ template class SyncQueue { - public: +public: SyncQueue() = default; - /* Push an item onto the queue and signal it's available. */ + /** + * @brief Push an item onto the queue and signal it's available. + * @param[in] value the item to add to the queue. + */ void push(const T& value) { std::unique_lock lock(mtx_); items_.push(value); @@ -25,13 +26,19 @@ class SyncQueue { signal_.notify_one(); } - /* Check if the queue is empty - thread safety via mutex. */ + /** + * @brief Check if the queue is empty - thread safety via mutex. + * @return True if the queue is empty. + */ bool empty() { std::unique_lock lock(mtx_); return items_.empty(); } - /* BLOCKING. Pull an item off the queue, or, wait until one arrives. */ + /** + * @brief Pull an item off the queue, or, wait until one arrives. Blocking. + * @return The front item that was popped off the queue. + */ T pull() { std::unique_lock lock(mtx_); signal_.wait(lock, [this] { return !items_.empty(); }); @@ -40,7 +47,7 @@ class SyncQueue { return ans; } - private: +private: std::mutex mtx_; std::queue items_; std::condition_variable signal_; From f73fd9fb952042999b055c6a2d7b1752b4a8d4aa Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 16:49:29 -0600 Subject: [PATCH 10/15] Move find(threads) to root list; use modern threads target. --- CMakeLists.txt | 3 +++ src/CMakeLists.txt | 5 +---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a5a86022..de0b96d9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,6 +51,9 @@ else() set(CUDA_USE_STATIC_CUDA_RUNTIME ON) endif() +# Require threads because of std::thread. +find_package(Threads REQUIRED) + find_package(CUDA 7.0 REQUIRED) if(NOT CUDA_FOUND) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index abc49a81..62199dc5 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -58,11 +58,8 @@ set_target_properties(popsift PROPERTIES DEBUG_POSTFIX "d") # cannot use PRIVATE here as there is a bug in FindCUDA and CUDA_ADD_LIBRARY # https://gitlab.kitware.com/cmake/cmake/issues/16097 -target_link_libraries(popsift ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES}) +target_link_libraries(popsift ${CUDA_CUDADEVRT_LIBRARY} ${CUDA_CUBLAS_LIBRARIES} Threads::Threads) -# Link to threads because we're using C++11 std::thread. -find_package(Threads REQUIRED) -target_link_libraries(popsift ${CMAKE_THREAD_LIBS_INIT}) # EXPORTING THE LIBRARY From 7a40eb30949893a87b65c0aef9974dd3e81c0678 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 16:50:30 -0600 Subject: [PATCH 11/15] Move boost static libs option down to application. --- CMakeLists.txt | 1 - src/application/CMakeLists.txt | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index de0b96d9..bddc2682 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ OPTION(PopSift_USE_POSITION_INDEPENDENT_CODE "Generate position independent code OPTION(PopSift_USE_GRID_FILTER "Switch off grid filtering to massively reduce compile time while debugging other things." ON) OPTION(PopSift_USE_NORMF "The __normf function computes Euclidian distance on large arrays. Fast but stability is uncertain." OFF) OPTION(PopSift_USE_TEST_CMD "Add testing step for functional verification" OFF) -OPTION(PopSift_BOOST_USE_STATIC_LIBS "Link examples with static Boost libraries" OFF) OPTION(PopSift_NVCC_WARNINGS "Switch on several additional warning for CUDA nvcc" OFF) if(PopSift_USE_POSITION_INDEPENDENT_CODE) diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index b2203379..d371ef96 100755 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -1,6 +1,8 @@ cmake_minimum_required(VERSION 3.0) project(PopsiftDemo LANGUAGES CXX) +OPTION(PopSift_BOOST_USE_STATIC_LIBS "Link examples with static Boost libraries" OFF) + if(TARGET popsift) # when compiled in the repository the target is already defined add_library(PopSift::popsift ALIAS popsift) From 54a68ec6315691e4225df9a99f4b02ff7b47cfeb Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 17:03:28 -0600 Subject: [PATCH 12/15] Remove boost from the popsift package; add threads. --- cmake/FindPopsift.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindPopsift.cmake b/cmake/FindPopsift.cmake index a9a48119..feb69acf 100644 --- a/cmake/FindPopsift.cmake +++ b/cmake/FindPopsift.cmake @@ -24,7 +24,7 @@ FIND_PATH(POPSIFT_INCLUDE_DIR popsift/popsift.h ) find_package(CUDA 7.0 REQUIRED) -find_package(Boost 1.53.0 REQUIRED COMPONENTS system filesystem) +find_package(Threads REQUIRED) IF(POPSIFT_INCLUDE_DIR) MESSAGE(STATUS "popsift headers found in ${POPSIFT_INCLUDE_DIR}") From 3c420e5304f9a1d1cf53f0fdad4009f7fe0ebb1b Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 17:15:15 -0600 Subject: [PATCH 13/15] Remove obsolete(?) win32 boost instructions. --- src/application/CMakeLists.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/application/CMakeLists.txt b/src/application/CMakeLists.txt index d371ef96..2c5113ff 100755 --- a/src/application/CMakeLists.txt +++ b/src/application/CMakeLists.txt @@ -22,8 +22,6 @@ endif() find_package(Boost 1.53.0 REQUIRED COMPONENTS filesystem program_options system) if(WIN32) add_definitions("-DBOOST_ALL_NO_LIB") - link_directories(Boost_LIBRARRY_DIR_DEBUG) - link_directories(Boost_LIBRARRY_DIR_RELEASE) endif(WIN32) set(PD_INCLUDE_DIRS ${Boost_INCLUDE_DIRS}) From f763f12e601d1cd5864395897540217a3d5f097d Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Fri, 10 Apr 2020 17:23:36 -0600 Subject: [PATCH 14/15] Find threads when loading the config if it hasn't been loaded yet. --- src/cmake/Config.cmake.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cmake/Config.cmake.in b/src/cmake/Config.cmake.in index 5aaa2d8e..4e97b309 100644 --- a/src/cmake/Config.cmake.in +++ b/src/cmake/Config.cmake.in @@ -36,8 +36,11 @@ # ################################################################################ - @PACKAGE_INIT@ +if(NOT TARGET Threads::Threads) + find_package(Threads REQUIRED) +endif() + include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake") check_required_components("@PROJECT_NAME@") From 249bbca4d298c456f3116053c3ef9fe1f97cf791 Mon Sep 17 00:00:00 2001 From: Andrew Hardin Date: Tue, 14 Apr 2020 08:56:20 -0600 Subject: [PATCH 15/15] Replace find_package with find_dependency. --- cmake/Config.cmake.in | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in index 60061676..30eea599 100644 --- a/cmake/Config.cmake.in +++ b/cmake/Config.cmake.in @@ -38,9 +38,8 @@ @PACKAGE_INIT@ -if(NOT TARGET Threads::Threads) - find_package(Threads REQUIRED) -endif() +include(CMakeFindDependencyMacro) +find_dependency(Threads REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/@popsift_targets_export_name@.cmake") check_required_components("@PROJECT_NAME@")