Browse Source

FindSQLite3: Use pkg-config for SQLite3 hints

Peter Kokot 1 year ago
parent
commit
fb30b18437
1 changed files with 11 additions and 2 deletions
  1. 11 2
      Modules/FindSQLite3.cmake

+ 11 - 2
Modules/FindSQLite3.cmake

@@ -32,12 +32,21 @@ This module will set the following variables if found:
 
 #]=======================================================================]
 
+find_package(PkgConfig QUIET)
+pkg_check_modules(PC_SQLite3 QUIET sqlite3)
+
 # Look for the necessary header
-find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h)
+find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h
+  HINTS
+    ${PC_SQLite3_INCLUDE_DIRS}
+)
 mark_as_advanced(SQLite3_INCLUDE_DIR)
 
 # Look for the necessary library
-find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite)
+find_library(SQLite3_LIBRARY NAMES sqlite3 sqlite
+  HINTS
+    ${PC_SQLite3_LIBRARY_DIRS}
+)
 mark_as_advanced(SQLite3_LIBRARY)
 
 # Extract version information from the header file