diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -747,32 +750,15 @@ if (DLIB_LINK_WITH_SQLITE3) - find_library(sqlite sqlite3) - # make sure sqlite3.h is in the include path - find_path(sqlite_path sqlite3.h) - if (sqlite AND sqlite_path) - set(dlib_needed_includes ${dlib_needed_includes} ${sqlite_path}) - set(dlib_needed_libraries ${dlib_needed_libraries} ${sqlite} ) - else() - set(DLIB_LINK_WITH_SQLITE3 OFF CACHE STRING ${DLIB_LINK_WITH_SQLITE3_STR} FORCE ) - endif() - mark_as_advanced(sqlite sqlite_path) + find_package(unofficial-sqlite3 CONFIG) + set(dlib_needed_libraries ${dlib_needed_libraries} unofficial::sqlite3::sqlite3) endif() if (DLIB_USE_FFTW) - find_library(fftw fftw3) - # make sure fftw3.h is in the include path - find_path(fftw_path fftw3.h) - if (fftw AND fftw_path) - set(dlib_needed_includes ${dlib_needed_includes} ${fftw_path}) - set(dlib_needed_libraries ${dlib_needed_libraries} ${fftw} ) - else() - set(DLIB_USE_FFTW OFF CACHE STRING ${DLIB_USE_FFTW_STR} FORCE ) - toggle_preprocessor_switch(DLIB_USE_FFTW) - endif() - mark_as_advanced(fftw fftw_path) + find_package(FFTW3 CONFIG) + set(dlib_needed_libraries ${dlib_needed_libraries} FFTW3::fftw3) endif() --- a/dlib/cmake_utils/dlibConfig.cmake.in +++ b/dlib/cmake_utils/dlibConfig.cmake.in @@ -28,6 +28,14 @@ include("${dlib_CMAKE_DIR}/dlib.cmake") endif() +include(CMakeFindDependencyMacro) +if("@DLIB_USE_FFTW@") + find_dependency(FFTW3 CONFIG) +endif() +if("@DLIB_LINK_WITH_SQLITE3@") + find_dependency(unofficial-sqlite3 CONFIG) +endif() + set(dlib_LIBRARIES dlib::dlib) set(dlib_LIBS dlib::dlib) set(dlib_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@" "@dlib_needed_includes@")