diff options
author | Alexander Neundorf <neundorf@kde.org> | 2010-09-26 17:38:06 +0000 |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2010-09-26 17:38:06 +0000 |
commit | d1c733912a28e2fe806e6d75f75b83fe303749da (patch) | |
tree | 8229f2623eb0bdd631a7ff192e5ce40582ee86db /modules | |
parent | 073b609b621d9fdec9beeaf3c8d42c41ad2050c0 (diff) | |
download | extra-cmake-modules-d1c733912a28e2fe806e6d75f75b83fe303749da.tar.gz extra-cmake-modules-d1c733912a28e2fe806e6d75f75b83fe303749da.tar.bz2 |
-add an include guard also to FindPkgConfig.cmake, should save parsing this 380 lines long file a few times during a kdelibs cmake run
Alex
svn path=/trunk/KDE/kdelibs/; revision=1179986
Diffstat (limited to 'modules')
-rw-r--r-- | modules/FindPkgConfig.cmake | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/modules/FindPkgConfig.cmake b/modules/FindPkgConfig.cmake index 84367633..6f2435ca 100644 --- a/modules/FindPkgConfig.cmake +++ b/modules/FindPkgConfig.cmake @@ -74,13 +74,13 @@ # # Redistribution and use, with or without modification, are permitted # provided that the following conditions are met: -# +# # 1. Redistributions must retain the above copyright notice, this # list of conditions and the following disclaimer. # 2. The name of the author may not be used to endorse or promote # products derived from this software without specific prior # written permission. -# +# # THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR # IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE @@ -100,7 +100,11 @@ # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. - +# Include guard, it's not necessary to parse this fail again and again: +IF(_FINDPKGCONFIG_ALREADY_INCLUDED AND PKG_CONFIG_EXECUTABLE) + RETURN() +ENDIF(_FINDPKGCONFIG_ALREADY_INCLUDED AND PKG_CONFIG_EXECUTABLE) +SET(_FINDPKGCONFIG_ALREADY_INCLUDED TRUE) ### Common stuff #### set(PKG_CONFIG_VERSION 1) @@ -162,7 +166,7 @@ endmacro(_pkgconfig_invoke_dyn) macro(_pkgconfig_parse_options _result _is_req _is_silent) set(${_is_req} 0) set(${_is_silent} 0) - + foreach(_pkg ${ARGN}) if (_pkg STREQUAL "REQUIRED") set(${_is_req} 1) @@ -213,7 +217,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) message(STATUS "checking for modules '${_pkg_check_modules_list}'") endif(_pkg_check_modules_cnt EQUAL 1) endif(NOT ${_is_silent}) - + set(_pkg_check_modules_packages) set(_pkg_check_modules_failed) @@ -240,14 +244,14 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) if (_pkg_check_modules_pkg_op STREQUAL "=") list(APPEND _pkg_check_modules_exist_query --exact-version) endif(_pkg_check_modules_pkg_op STREQUAL "=") - + if (_pkg_check_modules_pkg_op STREQUAL "<=") list(APPEND _pkg_check_modules_exist_query --max-version) endif(_pkg_check_modules_pkg_op STREQUAL "<=") # create the final query which is of the format: # * --atleast-version <version> <pkg-name> - # * --exact-version <version> <pkg-name> + # * --exact-version <version> <pkg-name> # * --max-version <version> <pkg-name> # * --exists <pkg-name> if (_pkg_check_modules_pkg_op) @@ -287,7 +291,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) else(_pkg_check_modules_failed) # when we are here, we checked whether requested modules # exist. Now, go through them and set variables - + _pkgconfig_set(${_prefix}_FOUND 1) list(LENGTH _pkg_check_modules_packages pkg_count) @@ -299,7 +303,7 @@ macro(_pkg_check_modules_internal _is_required _is_silent _prefix) else(pkg_count EQUAL 1) set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}") endif(pkg_count EQUAL 1) - + _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) @@ -369,9 +373,9 @@ macro(pkg_search_module _prefix _module0) message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found") endif(${_pkg_is_required}) endif(NOT ${_prefix}_FOUND) - + _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION}) - endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) + endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION} OR NOT ${_prefix}_FOUND) endmacro(pkg_search_module) ### Local Variables: |