From 674a9878983f223dd4855696852ba50f026556d1 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 9 Nov 2024 18:43:25 +0100 Subject: [PATCH 1/2] FindSQLite3: Guard calls to pkg_check_modules This was missed in commit 25b947589a (Modules: Guard calls to pkg_check_modules, 2024-08-07, v3.31.0-rc1~236^2). --- Modules/FindSQLite3.cmake | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Modules/FindSQLite3.cmake b/Modules/FindSQLite3.cmake index 308a444d62..e5fead7122 100644 --- a/Modules/FindSQLite3.cmake +++ b/Modules/FindSQLite3.cmake @@ -36,7 +36,9 @@ cmake_policy(PUSH) cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_ find_package(PkgConfig QUIET) -pkg_check_modules(PC_SQLite3 QUIET sqlite3) +if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_SQLite3 QUIET sqlite3) +endif() # Look for the necessary header find_path(SQLite3_INCLUDE_DIR NAMES sqlite3.h From 2d228201fcbf6397041108afdf5989cb83dcd7c3 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Sat, 9 Nov 2024 18:43:25 +0100 Subject: [PATCH 2/2] Help: Guard calls to pkg_check_modules in cmake-developer(7) example This was missed in commit 25b947589a (Modules: Guard calls to pkg_check_modules, 2024-08-07, v3.31.0-rc1~236^2). --- Help/manual/cmake-developer.7.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Help/manual/cmake-developer.7.rst b/Help/manual/cmake-developer.7.rst index cebe8f913e..fc7a27d972 100644 --- a/Help/manual/cmake-developer.7.rst +++ b/Help/manual/cmake-developer.7.rst @@ -408,7 +408,9 @@ starting point. .. code-block:: cmake find_package(PkgConfig) - pkg_check_modules(PC_Foo QUIET Foo) + if(PKG_CONFIG_FOUND) + pkg_check_modules(PC_Foo QUIET Foo) + endif() This should define some variables starting ``PC_Foo_`` that contain the information from the ``Foo.pc`` file.