vcpkg/ports/dlib/fix-sqlite3-fftw-linkage.patch

61 lines
2.2 KiB
Diff
Raw Normal View History

diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt
index 9f3001d..962cfc4 100644
--- a/dlib/CMakeLists.txt
+++ b/dlib/CMakeLists.txt
@@ -814,32 +814,15 @@ if (NOT TARGET dlib)
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()
diff --git a/dlib/cmake_utils/dlibConfig.cmake.in b/dlib/cmake_utils/dlibConfig.cmake.in
index 2667a2e..cc7b4a2 100644
--- a/dlib/cmake_utils/dlibConfig.cmake.in
+++ b/dlib/cmake_utils/dlibConfig.cmake.in
@@ -31,6 +31,14 @@ if(NOT TARGET dlib-shared AND NOT dlib_BINARY_DIR)
unset(dlib_deps_threads_check)
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@")