mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 02:08:27 +08:00
FindPkgConfig: Deprecate PKG_CONFIG_FOUND
Since most of the find modules use the `<PackageName>_FOUND` result variables, this now also syncs it for the FindPkgConfig module. The `PkgConfig_FOUND` result variable is available since CMake 3.3 and contains the same value. There is also `PKGCONFIG_FOUND` result variable automatically set with the same value but for simplicity isn't documented. The uppercased `<PACKAGENAME>_FOUND` result variables set by find modules are also considered legacy variables.
This commit is contained in:
@@ -415,7 +415,7 @@ starting point.
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(PkgConfig)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_Foo QUIET Foo)
|
||||
endif()
|
||||
|
||||
|
@@ -77,6 +77,10 @@ Find Modules
|
||||
result variable. The ``PKG_CONFIG_VERSION_STRING`` result variable is
|
||||
deprecated.
|
||||
|
||||
* The :module:`FindPkgConfig` module's result variable ``PKG_CONFIG_FOUND``
|
||||
is deprecated in favor of ``PkgConfig_FOUND``, which is available since
|
||||
CMake 3.3 and has the same value.
|
||||
|
||||
* The :module:`FindPNG` module now provides a ``PNG_VERSION`` result
|
||||
variable. The ``PNG_VERSION_STRING`` result variable is deprecated.
|
||||
|
||||
|
@@ -327,7 +327,7 @@ if(BLA_PREFER_PKGCONFIG)
|
||||
set(BLA_PKGCONFIG_BLAS "blas")
|
||||
endif()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PKGC_BLAS QUIET ${BLA_PKGCONFIG_BLAS})
|
||||
if(PKGC_BLAS_FOUND)
|
||||
set(BLAS_FOUND ${PKGC_BLAS_FOUND})
|
||||
|
@@ -187,7 +187,7 @@ if(NOT CURL_NO_CURL_CMAKE)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_CURL QUIET libcurl)
|
||||
if(PC_CURL_FOUND)
|
||||
pkg_get_variable(CURL_SUPPORTED_PROTOCOLS_STRING libcurl supported_protocols)
|
||||
|
@@ -322,7 +322,7 @@ set(CURSES_INCLUDE_DIRS ${CURSES_INCLUDE_PATH})
|
||||
set(CURSES_INCLUDE_DIR ${CURSES_INCLUDE_PATH}) # compatibility
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(NCURSES QUIET ${NCURSES_LIBRARY_NAME})
|
||||
set(CURSES_CFLAGS ${NCURSES_CFLAGS_OTHER})
|
||||
endif()
|
||||
|
@@ -84,7 +84,7 @@ cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_EXPAT QUIET expat)
|
||||
endif()
|
||||
|
||||
|
@@ -57,7 +57,7 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PKG_FONTCONFIG QUIET fontconfig)
|
||||
endif()
|
||||
set(Fontconfig_COMPILE_OPTIONS ${PKG_FONTCONFIG_CFLAGS_OTHER})
|
||||
|
@@ -77,7 +77,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/SelectLibraryConfigurations.cmake)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_GLUT QUIET glut)
|
||||
if(NOT PC_GLUT_FOUND)
|
||||
pkg_check_modules(PC_GLUT QUIET freeglut)
|
||||
|
@@ -115,7 +115,7 @@ endif()
|
||||
# This will return ``GSL_INCLUDEDIR`` and ``GSL_LIBDIR`` used below.
|
||||
if( GSL_USE_PKGCONFIG )
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules( GSL QUIET gsl )
|
||||
if( EXISTS "${GSL_INCLUDEDIR}" )
|
||||
get_filename_component( GSL_ROOT_DIR "${GSL_INCLUDEDIR}" DIRECTORY CACHE)
|
||||
|
@@ -707,7 +707,7 @@ endif()
|
||||
# used to compute the arch-specific include prefixes. While at it,
|
||||
# also retrieve their INCLUDEDIR, to accommodate non-standard layouts.
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_GTK2 QUIET gtk+-2.0)
|
||||
if(PC_GTK2_FOUND)
|
||||
pkg_get_variable(PC_GTK2_INCLUDEDIR gtk+-2.0 includedir)
|
||||
|
@@ -101,7 +101,7 @@ if (NOT WIN32)
|
||||
# in the find_path() and find_library() calls
|
||||
# also fills in GNUTLS_DEFINITIONS, although that isn't normally useful
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_GNUTLS QUIET gnutls)
|
||||
endif()
|
||||
set(GNUTLS_DEFINITIONS ${PC_GNUTLS_CFLAGS_OTHER})
|
||||
|
@@ -151,7 +151,7 @@ find_package(PkgConfig QUIET)
|
||||
function(FIND_IMAGEMAGICK_API component header)
|
||||
set(ImageMagick_${component}_FOUND FALSE PARENT_SCOPE)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_${component} QUIET ${component})
|
||||
endif()
|
||||
|
||||
|
@@ -327,7 +327,7 @@ if(BLA_PREFER_PKGCONFIG)
|
||||
set(BLA_PKGCONFIG_LAPACK "lapack")
|
||||
endif()
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PKGC_LAPACK QUIET ${BLA_PKGCONFIG_LAPACK})
|
||||
if(PKGC_LAPACK_FOUND)
|
||||
set(LAPACK_FOUND TRUE)
|
||||
|
@@ -93,7 +93,7 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_LIBXML QUIET libxml-2.0)
|
||||
endif()
|
||||
|
||||
|
@@ -127,7 +127,7 @@ cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the find_path() and find_library() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_LIBXSLT QUIET libxslt)
|
||||
endif()
|
||||
set(LIBXSLT_DEFINITIONS ${PC_LIBXSLT_CFLAGS_OTHER})
|
||||
@@ -153,7 +153,7 @@ find_library(LIBXSLT_LIBRARY NAMES xslt libxslt
|
||||
|
||||
set(LIBXSLT_LIBRARIES ${LIBXSLT_LIBRARY})
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_LIBXSLT_EXSLT QUIET libexslt)
|
||||
endif()
|
||||
set(LIBXSLT_EXSLT_DEFINITIONS ${PC_LIBXSLT_EXSLT_CFLAGS_OTHER})
|
||||
|
@@ -57,7 +57,7 @@ Finding the libinput library and linking it to a project target:
|
||||
# Use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PKG_Libinput QUIET libinput)
|
||||
endif()
|
||||
|
||||
|
@@ -1758,7 +1758,7 @@ foreach(LANG IN ITEMS C CXX Fortran)
|
||||
else()
|
||||
set(_MPI_PKG "")
|
||||
endif()
|
||||
if(_MPI_PKG AND PKG_CONFIG_FOUND)
|
||||
if(_MPI_PKG AND PkgConfig_FOUND)
|
||||
pkg_check_modules("MPI_${LANG}_PKG" "${_MPI_PKG}")
|
||||
if(MPI_${LANG}_PKG_FOUND)
|
||||
set(MPI_${LANG}_COMPILE_OPTIONS ${MPI_${LANG}_PKG_CFLAGS} CACHE STRING "MPI ${LANG} compilation options" FORCE)
|
||||
|
@@ -285,7 +285,7 @@ endfunction()
|
||||
|
||||
if (UNIX)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(_OPENSSL QUIET openssl)
|
||||
endif()
|
||||
endif ()
|
||||
|
@@ -26,7 +26,9 @@ Result Variables
|
||||
|
||||
This module defines the following variables:
|
||||
|
||||
``PKG_CONFIG_FOUND``
|
||||
``PkgConfig_FOUND``
|
||||
.. versionadded:: 3.3
|
||||
|
||||
Boolean indicating whether the (requested version of) ``pkg-config``
|
||||
executable is found.
|
||||
|
||||
@@ -335,6 +337,13 @@ Deprecated Variables
|
||||
|
||||
The following variables are provided for backward compatibility:
|
||||
|
||||
``PKG_CONFIG_FOUND``
|
||||
.. deprecated:: 4.2
|
||||
Use ``PkgConfig_FOUND``, which has the same value.
|
||||
|
||||
Boolean indicating whether the (requested version of) ``pkg-config``
|
||||
executable is found.
|
||||
|
||||
``PKG_CONFIG_VERSION_STRING``
|
||||
.. deprecated:: 4.2
|
||||
Use ``PkgConfig_VERSION``, which has the same value.
|
||||
@@ -377,7 +386,7 @@ Checking for any version of glib2. If found, the output variable
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(GLIB2 glib-2.0)
|
||||
endif()
|
||||
|
||||
@@ -388,7 +397,7 @@ the output variable ``GLIB2_VERSION`` will hold the actual version found:
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(GLIB2 glib-2.0>=2.10)
|
||||
endif()
|
||||
|
||||
@@ -401,7 +410,7 @@ will be set to their respective found module versions.
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(FOO glib-2.0>=2.10 gtk+-2.0)
|
||||
endif()
|
||||
|
||||
@@ -427,7 +436,7 @@ module specifications (``libxml-2.0`` or ``libxml2``):
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_search_module(BAR libxml-2.0 libxml2 libxml>=2)
|
||||
endif()
|
||||
|
||||
@@ -455,7 +464,7 @@ Gobject:
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir)
|
||||
endif()
|
||||
|
||||
@@ -558,7 +567,7 @@ find_package_handle_standard_args(PkgConfig
|
||||
# This is needed because the module name is "PkgConfig" but the name of
|
||||
# this variable has always been PKG_CONFIG_FOUND so this isn't automatically
|
||||
# handled by FPHSA.
|
||||
set(PKG_CONFIG_FOUND "${PKGCONFIG_FOUND}")
|
||||
set(PKG_CONFIG_FOUND "${PkgConfig_FOUND}")
|
||||
|
||||
# Unsets the given variables
|
||||
macro(_pkgconfig_unset var)
|
||||
|
@@ -59,7 +59,7 @@ cmake_policy(PUSH)
|
||||
cmake_policy(SET CMP0159 NEW) # file(STRINGS) with REGEX updates CMAKE_MATCH_<n>
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(PC_SQLite3 QUIET sqlite3)
|
||||
endif()
|
||||
|
||||
|
@@ -80,7 +80,7 @@ Migrating to the :module:`FindPkgConfig` would look something like this:
|
||||
.. code-block:: cmake
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
pkg_check_modules(LIBART QUIET libart-2.0)
|
||||
endif()
|
||||
|
||||
|
@@ -880,7 +880,7 @@ if (CMake_TEST_Qt4 AND Qt4_FOUND)
|
||||
endif()
|
||||
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PKG_CONFIG_FOUND)
|
||||
if(PkgConfig_FOUND)
|
||||
add_RunCMake_test(FindPkgConfig)
|
||||
endif()
|
||||
|
||||
|
@@ -2,5 +2,6 @@
|
||||
Reason given by package: The command
|
||||
"pkg-config-does-not-exist" --version
|
||||
failed with output.*
|
||||
-- PkgConfig_FOUND='FALSE'
|
||||
-- PKG_CONFIG_FOUND='FALSE'
|
||||
-- PKG_CONFIG_EXECUTABLE=''
|
||||
|
@@ -1,4 +1,5 @@
|
||||
set(PKG_CONFIG_EXECUTABLE "pkg-config-does-not-exist" CACHE FILEPATH "")
|
||||
find_package(PkgConfig)
|
||||
message(STATUS "PkgConfig_FOUND='${PkgConfig_FOUND}'")
|
||||
message(STATUS "PKG_CONFIG_FOUND='${PKG_CONFIG_FOUND}'")
|
||||
message(STATUS "PKG_CONFIG_EXECUTABLE='${PKG_CONFIG_EXECUTABLE}'")
|
||||
|
@@ -28,7 +28,7 @@ endif()
|
||||
|
||||
# We need a real pkg-config to run the test for get_variable.
|
||||
find_package(PkgConfig)
|
||||
if (PKG_CONFIG_FOUND)
|
||||
if (PkgConfig_FOUND)
|
||||
string(FIND "${CMAKE_CURRENT_BINARY_DIR}" " " IS_SPACES_IN_PATH)
|
||||
if(IS_SPACES_IN_PATH GREATER -1)
|
||||
string(REPLACE " " "\\ " ESCAPED_ROOT "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
Reference in New Issue
Block a user