[Cmake-commits] CMake branch, next, updated. v3.0.0-rc1-793-g0ff4988

Daniele E. Domenichelli daniele.domenichelli at gmail.com
Mon Mar 10 13:29:47 EDT 2014


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  0ff498857ed0327b590cec8732b155e573974907 (commit)
       via  b1dccd577c2d48b36a5777afc6a7ed68489fabe0 (commit)
       via  49ef91d7a6dc75b5bbc7a6b06ed909b23d13fd72 (commit)
      from  856819bff1a9b3197ad827cb827867f7b8812e2d (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=0ff498857ed0327b590cec8732b155e573974907
commit 0ff498857ed0327b590cec8732b155e573974907
Merge: 856819b b1dccd5
Author:     Daniele E. Domenichelli <daniele.domenichelli at gmail.com>
AuthorDate: Mon Mar 10 13:29:46 2014 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Mon Mar 10 13:29:46 2014 -0400

    Merge topic 'FindPkgConfig_Extend-PKG_CONFIG_PATH' into next
    
    b1dccd57 FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables
    49ef91d7 FindPkgConfig: restructure documentation and document commands and variables


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=b1dccd577c2d48b36a5777afc6a7ed68489fabe0
commit b1dccd577c2d48b36a5777afc6a7ed68489fabe0
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Thu Mar 6 18:55:04 2014 +0100
Commit:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
CommitDate: Mon Mar 10 18:27:46 2014 +0100

    FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables
    
    Use CMAKE_PREFIX_PATH, CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH
    cache and environment variables to extend PKG_CONFIG_PATH before calling
    pkg-config.
    
    In each of the path in these variables it searches for lib/pkgconfig.
    Then, depending on the system, it searches for
    lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig (debian) or for
    lib64/pkgconfig (other 64 bit unixes). If any of these path is found,
    it is appended to the PKG_CONFIG_PATH enviromnent variable.
    
    Add two new arguments to the pkg_check_module and pkg_search_module
    macro, NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH. The new signature
    are therefore:
    
       pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
                         [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
                         <MODULE> [<MODULE>]*)
       pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
                         [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
                         <MODULE> [<MODULE>]*)
    
    By default, if CMAKE_MINIMUM_REQUIRED_VERSION is 3.1 or later (in
    order to keep compatibility with the previous behavior), or if
    PKG_CONFIG_USE_CMAKE_PREFIX_PATH is set, the CMAKE_PREFIX_PATH,
    CMAKE_FRAMEWORK_PATH, and CMAKE_APPBUNDLE_PATH cache and environment
    variables will be added to pkgconfig search path.
    
    The NO_CMAKE_PATH and NO_CMAKE_ENVIRONMENT_PATH arguments disable this
    behavior for the cache variables and the environment variables,
    respectively, similarly to the find_package() command.

diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index b0ceb2b..aacdc8f 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -99,9 +99,20 @@ macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
 endmacro()
 
 # Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req _is_silent)
+macro(_pkgconfig_parse_options _result _is_req _is_silent _no_cmake_path _no_cmake_environment_path)
   set(${_is_req} 0)
   set(${_is_silent} 0)
+  set(${_no_cmake_path} 0)
+  set(${_no_cmake_environment_path} 0)
+  if(DEFINED PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+    if(NOT PKG_CONFIG_USE_CMAKE_PREFIX_PATH)
+      set(${_no_cmake_path} 1)
+      set(${_no_cmake_environment_path} 1)
+    endif()
+  elseif(${CMAKE_MINIMUM_REQUIRED_VERSION} VERSION_LESS 3.1)
+    set(${_no_cmake_path} 1)
+    set(${_no_cmake_environment_path} 1)
+  endif()
 
   foreach(_pkg ${ARGN})
     if (_pkg STREQUAL "REQUIRED")
@@ -110,15 +121,23 @@ macro(_pkgconfig_parse_options _result _is_req _is_silent)
     if (_pkg STREQUAL "QUIET")
       set(${_is_silent} 1)
     endif ()
+    if (_pkg STREQUAL "NO_CMAKE_PATH")
+      set(${_no_cmake_path} 1)
+    endif()
+    if (_pkg STREQUAL "NO_CMAKE_ENVIRONMENT_PATH")
+      set(${_no_cmake_environment_path} 1)
+    endif()
   endforeach()
 
   set(${_result} ${ARGN})
   list(REMOVE_ITEM ${_result} "REQUIRED")
   list(REMOVE_ITEM ${_result} "QUIET")
+  list(REMOVE_ITEM ${_result} "NO_CMAKE_PATH")
+  list(REMOVE_ITEM ${_result} "NO_CMAKE_ENVIRONMENT_PATH")
 endmacro()
 
 ###
-macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
+macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _prefix)
   _pkgconfig_unset(${_prefix}_FOUND)
   _pkgconfig_unset(${_prefix}_VERSION)
   _pkgconfig_unset(${_prefix}_PREFIX)
@@ -157,6 +176,101 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
     set(_pkg_check_modules_packages)
     set(_pkg_check_modules_failed)
 
+    set(_extra_paths)
+
+    if(NOT _no_cmake_path)
+      if(NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
+        list(APPEND _extra_paths ${CMAKE_PREFIX_PATH})
+      endif()
+      if(NOT "${CMAKE_FRAMEWORK_PATH}" STREQUAL "")
+        list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH})
+      endif()
+      if(NOT "${CMAKE_APPBUNDLE_PATH}" STREQUAL "")
+        list(APPEND _extra_paths ${CMAKE_FRAMEWORK_PATH})
+      endif()
+    endif()
+
+    if(NOT _no_cmake_environment_path)
+      if(NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
+        file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _path)
+        if(UNIX)
+          string(REPLACE "\\:" ";" _path "${_path}")
+        endif()
+        list(APPEND _extra_paths ${_path})
+        unset(_path)
+      endif()
+      if(NOT "$ENV{CMAKE_FRAMEWORK_PATH}" STREQUAL "")
+        file(TO_CMAKE_PATH "$ENV{CMAKE_FRAMEWORK_PATH}" _path)
+        if(UNIX)
+          string(REPLACE "\\:" ";" _path "${_path}")
+        endif()
+        list(APPEND _extra_paths ${_path})
+        unset(_path)
+      endif()
+      if(NOT "$ENV{CMAKE_APPBUNDLE_PATH}" STREQUAL "")
+        file(TO_CMAKE_PATH "$ENV{CMAKE_APPBUNDLE_PATH}" _path)
+        if(UNIX)
+          string(REPLACE "\\:" ";" _path "${_path}")
+        endif()
+        list(APPEND _extra_paths ${_path})
+        unset(_path)
+      endif()
+    endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Save the PKG_CONFIG_PATH environment variable, and add paths
+      # from the CMAKE_PREFIX_PATH variables
+      set(_pkgconfig_path_old $ENV{PKG_CONFIG_PATH})
+      set(_pkgconfig_path ${_pkgconfig_path_old})
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        file(TO_CMAKE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+      endif()
+
+      # Create a list of the possible pkgconfig subfolder (depending on
+      # the system
+      set(_lib_dirs)
+      if(NOT DEFINED CMAKE_SYSTEM_NAME
+          OR (CMAKE_SYSTEM_NAME MATCHES "^(Linux|kFreeBSD|GNU)$"
+              AND NOT CMAKE_CROSSCOMPILING))
+        if(EXISTS "/etc/debian_version") # is this a debian system ?
+          if(CMAKE_LIBRARY_ARCHITECTURE)
+            list(APPEND _lib_dirs "lib/${CMAKE_LIBRARY_ARCHITECTURE}/pkgconfig")
+          endif()
+        else()
+          # not debian, chech the FIND_LIBRARY_USE_LIB64_PATHS property
+          get_property(uselib64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+          if(uselib64)
+            list(APPEND _lib_dirs "lib64/pkgconfig")
+          endif()
+        endif()
+      endif()
+      list(APPEND _lib_dirs "lib/pkgconfig")
+
+      # Check if directories exist and eventually append them to the
+      # pkgconfig path list
+      foreach(_prefix_dir ${_extra_paths})
+        foreach(_lib_dir ${_lib_dirs})
+          if(EXISTS "${_prefix_dir}/${_lib_dir}")
+            list(APPEND _pkgconfig_path "${_prefix_dir}/${_lib_dir}")
+            list(REMOVE_DUPLICATES _pkgconfig_path)
+          endif()
+        endforeach()
+      endforeach()
+
+      # Prepare and set the environment variable
+      if(NOT "${_pkgconfig_path}" STREQUAL "")
+        file(TO_NATIVE_PATH "${_pkgconfig_path}" _pkgconfig_path)
+        if(UNIX)
+          string(REPLACE ";" ":" _pkgconfig_path "${_pkgconfig_path}")
+        endif()
+        set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+      endif()
+
+      # Unset variables
+      unset(_lib_dirs)
+      unset(_pkgconfig_path)
+    endif()
+
     # iterate through module list and check whether they exist and match the required version
     foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
       set(_pkg_check_modules_exist_query)
@@ -260,6 +374,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
       _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS              ""        --cflags )
       _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER        ""        --cflags-only-other )
     endif()
+
+    if(NOT "${_extra_paths}" STREQUAL "")
+      # Restore the environment variable
+      set(ENV{PKG_CONFIG_PATH} ${_pkgconfig_path})
+    endif()
+
+    unset(_extra_paths)
+    unset(_pkgconfig_path_old)
   else()
     if (${_is_required})
       message(SEND_ERROR "pkg-config tool not found")
@@ -276,13 +398,25 @@ endmacro()
 
  Checks for all the given modules. ::
 
-    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET]
+                      [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+                      <MODULE> [<MODULE>]*)
+
 
  When the ``REQUIRED`` argument was set, macros will fail with an error
  when module(s) could not be found.
 
  When the ``QUIET`` argument is set, no status messages will be printed.
 
+ By default, if :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or
+ later, or if :variable:`PKG_CONFIG_USE_CMAKE_PREFIX_PATH` is set, the
+ :variable:`CMAKE_PREFIX_PATH`, :variable:`CMAKE_FRAMEWORK_PATH`, and
+ :variable:`CMAKE_APPBUNDLE_PATH` cache and environment variables will
+ be added to ``pkg-config`` search path.
+ The ``NO_CMAKE_PATH`` and ``NO_CMAKE_ENVIRONMENT_PATH`` arguments
+ disable this behavior for the cache variables and the environment
+ variables, respectively.
+
  It sets the following variables: ::
 
     PKG_CONFIG_FOUND          ... if pkg-config executable was found
@@ -362,8 +496,8 @@ endmacro()
 macro(pkg_check_modules _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
-    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
-    _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" "${_prefix}" ${_pkg_modules})
+    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
+    _pkg_check_modules_internal("${_pkg_is_required}" "${_pkg_is_silent}" ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" ${_pkg_modules})
 
     _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
   endif()
@@ -376,7 +510,9 @@ endmacro()
  Same as :command:`pkg_check_modules`, but instead it checks for given
  modules and uses the first working one. ::
 
-    pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+    pkg_search_module(<PREFIX> [REQUIRED] [QUIET]
+                      [NO_CMAKE_PATH] [NO_CMAKE_ENVIRONMENT_PATH]
+                      <MODULE> [<MODULE>]*)
 
  Examples
 
@@ -388,7 +524,7 @@ macro(pkg_search_module _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
     set(_pkg_modules_found 0)
-    _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent "${_module0}" ${ARGN})
+    _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required _pkg_is_silent _no_cmake_path _no_cmake_environment_path "${_module0}" ${ARGN})
 
     if (NOT ${_pkg_is_silent})
       message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
@@ -397,7 +533,7 @@ macro(pkg_search_module _prefix _module0)
     # iterate through all modules and stop at the first working one.
     foreach(_pkg_alt ${_pkg_modules_alt})
       if(NOT _pkg_modules_found)
-        _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
+        _pkg_check_modules_internal(0 1 ${_no_cmake_path} ${_no_cmake_environment_path} "${_prefix}" "${_pkg_alt}")
       endif()
 
       if (${_prefix}_FOUND)
@@ -420,6 +556,18 @@ endmacro()
 .. variable:: PKG_CONFIG_EXECUTABLE
 
  Path to the pkg-config executable.
+
+
+.. variable:: PKG_CONFIG_USE_CMAKE_PREFIX_PATH
+
+ Whether :command:`pkg_check_modules` and :command:`pkg_search_module`
+ should add the paths in :variable:`CMAKE_PREFIX_PATH`,
+ :variable:`CMAKE_FRAMEWORK_PATH`, and :variable:`CMAKE_APPBUNDLE_PATH`
+ cache and environment variables to ``pkg-config`` search path.
+
+ If this variable is not set, this behavior is enabled by default if
+ :variable:`CMAKE_MINIMUM_REQUIRED_VERSION` is 3.1 or later, disabled
+ otherwise.
 #]========================================]
 
 

http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=49ef91d7a6dc75b5bbc7a6b06ed909b23d13fd72
commit 49ef91d7a6dc75b5bbc7a6b06ed909b23d13fd72
Author:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
AuthorDate: Thu Mar 6 18:54:52 2014 +0100
Commit:     Daniele E. Domenichelli <daniele.domenichelli at iit.it>
CommitDate: Mon Mar 10 18:27:46 2014 +0100

    FindPkgConfig: restructure documentation and document commands and variables

diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake
index 7179d17..b0ceb2b 100644
--- a/Modules/FindPkgConfig.cmake
+++ b/Modules/FindPkgConfig.cmake
@@ -2,141 +2,15 @@
 # FindPkgConfig
 # -------------
 #
-# a pkg-config module for CMake
+# A `pkg-config` module for CMake.
 #
+# Finds the ``pkg-config`` executable and add the
+# :command:`pkg_check_modules` and :command:`pkg_search_module`
+# commands.
 #
-#
-# To find the pkg-config executable, it uses the variable
-# PKG_CONFIG_EXECUTABLE or the environment variable PKG_CONFIG first.
-#
-#
-#
-# Usage:
-#
-# ::
-#
-#    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-#      checks for all the given modules
-#
-#
-#
-# ::
-#
-#    pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
-#      checks for given modules and uses the first working one
-#
-#
-#
-# When the 'REQUIRED' argument was set, macros will fail with an error
-# when module(s) could not be found
-#
-# When the 'QUIET' argument is set, no status messages will be printed.
-#
-# It sets the following variables:
-#
-# ::
-#
-#    PKG_CONFIG_FOUND          ... if pkg-config executable was found
-#    PKG_CONFIG_EXECUTABLE     ... pathname of the pkg-config program
-#    PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
-#                                  (since CMake 2.8.8)
-#
-#
-#
-# For the following variables two sets of values exist; first one is the
-# common one and has the given PREFIX.  The second set contains flags
-# which are given out when pkgconfig was called with the '--static'
-# option.
-#
-# ::
-#
-#    <XPREFIX>_FOUND          ... set to 1 if module(s) exist
-#    <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
-#    <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
-#    <XPREFIX>_LDFLAGS        ... all required linker flags
-#    <XPREFIX>_LDFLAGS_OTHER  ... all other linker flags
-#    <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
-#    <XPREFIX>_CFLAGS         ... all required cflags
-#    <XPREFIX>_CFLAGS_OTHER   ... the other compiler flags
-#
-#
-#
-# ::
-#
-#    <XPREFIX> = <PREFIX>        for common case
-#    <XPREFIX> = <PREFIX>_STATIC for static linking
-#
-#
-#
-# There are some special variables whose prefix depends on the count of
-# given modules.  When there is only one module, <PREFIX> stays
-# unchanged.  When there are multiple modules, the prefix will be
-# changed to <PREFIX>_<MODNAME>:
-#
-# ::
-#
-#    <XPREFIX>_VERSION    ... version of the module
-#    <XPREFIX>_PREFIX     ... prefix-directory of the module
-#    <XPREFIX>_INCLUDEDIR ... include-dir of the module
-#    <XPREFIX>_LIBDIR     ... lib-dir of the module
-#
-#
-#
-# ::
-#
-#    <XPREFIX> = <PREFIX>  when |MODULES| == 1, else
-#    <XPREFIX> = <PREFIX>_<MODNAME>
-#
-#
-#
-# A <MODULE> parameter can have the following formats:
-#
-# ::
-#
-#    {MODNAME}            ... matches any version
-#    {MODNAME}>={VERSION} ... at least version <VERSION> is required
-#    {MODNAME}={VERSION}  ... exactly version <VERSION> is required
-#    {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
-#
-#
-#
-# Examples
-#
-# ::
-#
-#    pkg_check_modules (GLIB2   glib-2.0)
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (GLIB2   glib-2.0>=2.10)
-#      requires at least version 2.10 of glib2 and defines e.g.
-#        GLIB2_VERSION=2.10.3
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)
-#      requires both glib2 and gtk2, and defines e.g.
-#        FOO_glib-2.0_VERSION=2.10.3
-#        FOO_gtk+-2.0_VERSION=2.8.20
-#
-#
-#
-# ::
-#
-#    pkg_check_modules (XRENDER REQUIRED xrender)
-#      defines e.g.:
-#        XRENDER_LIBRARIES=Xrender;X11
-#        XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
-#
-#
-#
-# ::
-#
-#    pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)
+# In order to find the ``pkg-config`` executable, it uses the
+# :variable:`PKG_CONFIG_EXECUTABLE` variable or the ``PKG_CONFIG``
+# environment variable first.
 
 #=============================================================================
 # Copyright 2006-2014 Kitware, Inc.
@@ -397,7 +271,94 @@ endmacro()
 ### User visible macros start here
 ###
 
-###
+#[========================================[.rst:
+.. command:: pkg_check_modules
+
+ Checks for all the given modules. ::
+
+    pkg_check_modules(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+
+ When the ``REQUIRED`` argument was set, macros will fail with an error
+ when module(s) could not be found.
+
+ When the ``QUIET`` argument is set, no status messages will be printed.
+
+ It sets the following variables: ::
+
+    PKG_CONFIG_FOUND          ... if pkg-config executable was found
+    PKG_CONFIG_EXECUTABLE     ... pathname of the pkg-config program
+    PKG_CONFIG_VERSION_STRING ... the version of the pkg-config program found
+                                  (since CMake 2.8.8)
+
+ For the following variables two sets of values exist; first one is the
+ common one and has the given PREFIX.  The second set contains flags
+ which are given out when ``pkg-config`` was called with the ``--static``
+ option. ::
+
+    <XPREFIX>_FOUND          ... set to 1 if module(s) exist
+    <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
+    <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
+    <XPREFIX>_LDFLAGS        ... all required linker flags
+    <XPREFIX>_LDFLAGS_OTHER  ... all other linker flags
+    <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
+    <XPREFIX>_CFLAGS         ... all required cflags
+    <XPREFIX>_CFLAGS_OTHER   ... the other compiler flags
+
+ ::
+
+    <XPREFIX> = <PREFIX>        for common case
+    <XPREFIX> = <PREFIX>_STATIC for static linking
+
+ There are some special variables whose prefix depends on the count of
+ given modules.  When there is only one module, <PREFIX> stays
+ unchanged.  When there are multiple modules, the prefix will be
+ changed to <PREFIX>_<MODNAME>: ::
+
+    <XPREFIX>_VERSION    ... version of the module
+    <XPREFIX>_PREFIX     ... prefix-directory of the module
+    <XPREFIX>_INCLUDEDIR ... include-dir of the module
+    <XPREFIX>_LIBDIR     ... lib-dir of the module
+
+ ::
+
+    <XPREFIX> = <PREFIX>  when |MODULES| == 1, else
+    <XPREFIX> = <PREFIX>_<MODNAME>
+
+ A <MODULE> parameter can have the following formats: ::
+
+    {MODNAME}            ... matches any version
+    {MODNAME}>={VERSION} ... at least version <VERSION> is required
+    {MODNAME}={VERSION}  ... exactly version <VERSION> is required
+    {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
+
+ Examples
+
+ .. code-block:: cmake
+
+    pkg_check_modules (GLIB2   glib-2.0)
+
+ .. code-block:: cmake
+
+    pkg_check_modules (GLIB2   glib-2.0>=2.10)
+
+ Requires at least version 2.10 of glib2 and defines e.g.
+ ``GLIB2_VERSION=2.10.3``
+
+ .. code-block:: cmake
+
+    pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)
+
+ Requires both glib2 and gtk2, and defines e.g.
+ ``FOO_glib-2.0_VERSION=2.10.3`` and ``FOO_gtk+-2.0_VERSION=2.8.20``
+
+ .. code-block:: cmake
+
+    pkg_check_modules (XRENDER REQUIRED xrender)
+
+ Defines e.g.:
+ ``XRENDER_LIBRARIES=Xrender;X11`` and
+ ``XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp``
+#]========================================]
 macro(pkg_check_modules _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
@@ -408,7 +369,21 @@ macro(pkg_check_modules _prefix _module0)
   endif()
 endmacro()
 
-###
+
+#[========================================[.rst:
+.. command:: pkg_search_module
+
+ Same as :command:`pkg_check_modules`, but instead it checks for given
+ modules and uses the first working one. ::
+
+    pkg_search_module(<PREFIX> [REQUIRED] [QUIET] <MODULE> [<MODULE>]*)
+
+ Examples
+
+ .. code-block:: cmake
+
+    pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)
+#]========================================]
 macro(pkg_search_module _prefix _module0)
   # check cached value
   if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND)
@@ -440,6 +415,14 @@ macro(pkg_search_module _prefix _module0)
   endif()
 endmacro()
 
+
+#[========================================[.rst:
+.. variable:: PKG_CONFIG_EXECUTABLE
+
+ Path to the pkg-config executable.
+#]========================================]
+
+
 ### Local Variables:
 ### mode: cmake
 ### End:

-----------------------------------------------------------------------

Summary of changes:
 Modules/FindPkgConfig.cmake |  413 ++++++++++++++++++++++++++++---------------
 1 file changed, 272 insertions(+), 141 deletions(-)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list