summaryrefslogtreecommitdiff
path: root/Modules/FindPkgConfig.cmake
Commit message (Collapse)AuthorAgeFilesLines
* FindPkgConfig: Revert "Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET."Brad King2022-06-221-92/+44
| | | | | | | | | | Revert commit 020976d637 (FindPkgConfig: Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET., 2021-12-31, v3.24.0-rc1~105^2). Several regressions have been reported. Revert the feature pending further discussion and design work. Issue: #21714 Fixes: #23642
* Merge topic 'pkgconfig-static-libs'Brad King2022-05-231-45/+95
|\ | | | | | | | | | | | | | | | | | | 020976d637 FindPkgConfig: Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET. 3c5cc79adb Tests: De-duplicate some code in RunCMake.FindPkgConfig 5cfbc76371 FindPkgConfig: Fix parsing of backslash-escaped spaces in pkg-config output Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !7070
| * FindPkgConfig: Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET.Alex Birch2022-05-201-44/+92
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add LINK_LIBRARIES test to demonstrate static linking of transitive dependencies. Add STATIC_TARGET argument to pkg_check_modules() and pkg_search_module(). Influences the properties of target produced by IMPORTED_TARGET. When enabled: target's properties will be populated from <XXX>_STATIC_* variables instead of from <XXX>_* variables. Update existing tests concerning properties of targets produced via IMPORTED_TARGET, to test STATIC_TARGET variant too. Update existing tests concerning <XXX>_* variables to test <XXX>_STATIC_* variables too. Breaking changes to pkg_check_modules() and pkg_search_module(): - Variables CMAKE_FIND_LIBRARY_PREFIXES and CMAKE_FIND_LIBRARY_SUFFIXES can no longer be used to influence library lookup (i.e. the internal call to find_library()), because FindPkgConfig now internally relies on these variables to differentiate between shared and static library lookup. Prefer CMAKE_SHARED_LIBRARY_PREFIX + CMAKE_SHARED_LIBRARY_SUFFIX, or CMAKE_STATIC_LIBRARY_PREFIX + CMAKE_STATIC_LIBRARY_SUFFIX, depending on whether you wish to impact static or shared lookup. - <XXX>_LINK_LIBRARIES will now be populated only with libraries located via CMAKE_SHARED_LIBRARY_PREFIX + CMAKE_SHARED_LIBRARY_SUFFIX match - <XXX>_STATIC_LIBRARIES now processes -framework options - <XXX>_STATIC_LDFLAGS_OTHER now processes -framework options - <XXX>_STATIC_CFLAGS_OTHER now processes -isystem options - <XXX>_STATIC_INCLUDE_DIRS now processes -isystem options Fixes: #21714
| * FindPkgConfig: Fix parsing of backslash-escaped spaces in pkg-config outputAlex Birch2022-05-121-1/+3
| | | | | | | | | | | | | | | | Treat backslash-escaped spaces as "space within argument" rather than "space delimiting arguments". Update our `FindPkgConfig_LIBRARY_PATH` test case to escape spaces in the path, and run it unconditionally.
* | FindPkgConfig: Fix preservation of ENV{PKG_CONFIG_ALLOW_SYSTEM_LIBS}Brad King2022-05-121-1/+3
|/ | | | | | | | | | | | Fix the ENV save/restore added by commit 36979f5b43 (FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_LIBRARY_PATH in environment, 2021-07-13, v3.22.0-rc1~407^2) to unset the variable if it was originally not set. While at it, clarify the value to which we temporarily set it. The `pkg-config` and `pkgconf` tools only check that the variable is set, and do not care about the value. Set it to a more true-looking value. Issue: #22148
* FindPkgConfig: Restore finding pkg-config before pkgconfBrad King2021-12-021-1/+1
| | | | | | | | | | | Since commit 94a84dc0af (FindPkgConfig: add pkgconf to the search list., 2021-07-02, v3.22.0-rc1~468^2), `pkgconf` is preferred over `pkg-config` if they appear in the same directory. In some environments, `pkg-config` may be a wrapper that adds semantics beyond either `pkgconf` or the normal `pkg-config`. Prefer `pkg-config` over `pkgconf` in order to preserve the prior behavior in such environments. Fixes: #22976
* Help: Clarify how PKG_CONFIG env var initializes cache varsCraig Scott2021-11-071-16/+33
| | | Fixes: #22870
* Merge topic 'FindPkgConfig-restore-legacy-behavior'Brad King2021-08-191-0/+8
|\ | | | | | | | | | | | | 17e4934dbf FindPkgConfig: Restore legacy behavior when CMP0126 is set to NEW Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !6461
| * FindPkgConfig: Restore legacy behavior when CMP0126 is set to NEWMarc Chevrier2021-08-181-0/+8
| | | | | | | | | | | | Module behavior must be independent from `CMP0126` policy. Fixes: #22526
* | FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_LIBRARY_PATH in environmentBrad King2021-07-131-0/+12
| | | | | | | | | | | | | | | | Tell `pkg-config --libs` not to filter out `-L` flags for entries of `PKG_CONFIG_SYSTEM_LIBRARY_PATH` (and `LIBRARY_PATH` for `pkgconf`). We should always search everywhere the `.pc` file expects. Fixes: #22148
* | FindPkgConfig: add pkgconf to the search list.Alexander Neumann2021-07-021-0/+1
| |
* | FindPkgConfig: split args if loaded from environmentChristopher Degawa2021-06-181-5/+34
|/ | | | | | | | | | | | | | | It's common for some people to use the PKG_CONFIG environment variable to not only load a custom pkg-config/pkgconf but also to load some default arguments such as `--static` or `--keep-system-libs` which often worked since shell scripts would call `$PKG_CONFIG --libs pkg` without quotes, but this breaks FindPkgConfig since it uses the full string as `argv[0]` and might try looking for a binary called `pkgconf --static`, instead of looking for `pkgconf` and adding `--static` as the `argv[1]` Additionally adds RunCMake.FindPkgConfig ARGN test case Fixes: #22305 Signed-off-by: Christopher Degawa <ccom@randomderp.com>
* FindPkgConfig: Always create the imported targetAdam Badura2021-06-041-3/+1
| | | | Fixes: #22180
* Merge topic 'FindPkgConfig-NAMES_PER_DIR'Brad King2021-03-171-1/+4
|\ | | | | | | | | | | | | c7bd2d0d97 FindPkgConfig: Restore preference for first pkg-config in PATH Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5914
| * FindPkgConfig: Restore preference for first pkg-config in PATHBrad King2021-03-161-1/+4
| | | | | | | | | | | | | | | | | | | | Since commit ab8bd48352 (FindPkgConfig: Search for pkg-config.bat file on a Windows host, 2020-09-25, v3.19.0-rc1~98^2) we prefer `pkg-config.bat` over `pkg-config` regardless of the order they appear in the `PATH`. Tell `find_program` to consider all names in each directory so that the first one in `PATH` of any name wins. Issue: #21239
* | Help: Add `.. versionadded` directives to module docsNikita Nemkin2020-12-021-17/+59
|/ | | | Issue: #19715
* FindPkgConfig: Search for pkg-config.bat file on a Windows hostAlexandru Croitor2020-09-251-1/+7
| | | | | | | | | | | | | | | | The strawberry perl distribution ships a pkg-config file and a pkg-config.bat file. find_program() does not usually look for a .bat file program unless explicitly specified in the NAMES argument. This would cause CMake to find the non-bat file, and executing that with execute_process() leads to a '%1 is not a valid Win32 application' error. Prefer to search for pkg-config.bat file when on a Windows host, in additiona to the regular pkg-config file. Fixes: #21239
* FindPkgConfig: Show more info when pkg-config --version failsAlexandru Croitor2020-09-251-1/+3
| | | | Fixes: #21239
* FindPkgConfig: also handle "-isystem" prefixes for include directoriesRolf Eike Beer2020-05-051-7/+41
| | | | Fixes: #20652
* FindPkgConfig: fix handling of frameworksRolf Eike Beer2020-04-181-0/+37
|
* FindPkgConfig: Unset results when pkg-config is brokenBrad King2020-03-161-3/+18
| | | | Inspired-by: FUJI Goro <goro@fastly.com>
* Merge topic 'FindPkgConfig-scope'Brad King2020-02-251-0/+6
|\ | | | | | | | | | | | | c3e0d1ffe9 FindPkgConfig: set policies CMP0054 and CMP0057 to new Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4388
| * FindPkgConfig: set policies CMP0054 and CMP0057 to newRolf Eike Beer2020-02-241-0/+6
| | | | | | | | | | | | One may encounter warnings if FindPkgConfig is used in any project, even indirectly, that has set any of these policies to old explicitely or requires an older version.
* | FindPkgConfig: Fix path manipulations when cross compilingHugo Beauzée-Luyssen2019-12-021-1/+1
|/ | | | | | When cross compiling from a unix machine, if(UNIX) is false, whih causes the path not to be fixed for unix, leading to false negative if PKG_CONFIG_PATH needs to be probed
* FindPkgConfig: Allow libraries that can't be found with their full pathChuck Atkins2019-09-161-1/+5
| | | | | | | | | | | | pkg-config's .pc files can sometimes provide libraries that are visible to the linker but not present in CMake's known search paths. In the case where CMake can find some, but not all of the library dependencies provided in a .pc file, this allows them to be passed through as "-lfoo" when the full path can't be found. This also removes the test failure cases that occured because of this scenario and adjsuts the remaining tests to account for not-found libraries
* FindPkgConfig: return the module found by pkg_search_moduleChristophe Giboudeaux2019-08-291-0/+7
| | | | | | | | | | When running `pkg_search_module`, it may be useful to get the matching module name in order to run `pkg_get_variable`. `pkg_search_module` now defines `<prefix>_MODULE_NAME` which contains the first matching module name. Fixes: #19648
* pkg_get_variable now sets PKG_CONFIG_PATH like pkg_check_modulesDan Kegel2019-03-201-24/+34
| | | | Fixes: #15805
* FindPkgConfig: hoist PKG_CONFIG_PATH ops out into _pkg_set_path_internalDan Kegel2019-03-201-89/+98
|
* FindPkgConfig: Set linker flags on imported targetsRadek Nadstawny2019-03-131-1/+5
|
* PkgConfig: Be less verbose by mark(ing)_as_advanced the find_library resultSylvain Joubert2018-11-071-0/+1
|
* Help: Override pygments CMakeLexer to support <..> and [..]Joachim Wuttke (o)2018-10-191-10/+16
| | | | | | | | | | | | | | | | | | | | | | * The code snippets in the docs consist of CMake code mixed with syntax definition punctuation like < > [ ] ... Therefore a pure CMake lexer is inadequate. Here it is replaced by a CMake syntax definition parser. * Fixed syntax definition snippets in FindPkgConfig.cmake to make best use of syntax highlighting. This source file is the hardest to support because it contains comparison operators <= = >=, which need special attention to avoid confusion with the placeholder indicators <...>. * Fixed syntax in execute_process.rst (there were unbalanced brackets). * Disabled syntax highlighting for long string examples in cmake-language.7.rst. * No highlighting of removed syntax in CMP0049 * To inspect the outcome of this patch, see e.g. the pages * manual/cmake-buildsystem.7.html * module/ExternalProject.html * module/FindPkgConfig.html which are particularly rich in complex code snippets.
* Help: Use appropriate list types in FindPkgConfigJoachim Wuttke (l)2018-10-171-27/+42
|
* FindPkgConfig: Document support for > and < operatorsCraig Scott2018-10-151-6/+9
| | | | | This was left out of commit v3.13.0-rc1~14^2 (FindPkgConfig: support also > and < operators for version compares, 2018-10-02).
* FindPkgConfig: support also > and < operators for version comparesRolf Eike Beer2018-10-041-1/+3
| | | | Fixes: #18416
* FindPkgConfig: allow to create global imported targetsRolf Eike Beer2018-07-221-16/+31
|
* FindPkgConfig: export the list of found libraries also as variableRolf Eike Beer2018-05-111-12/+27
|
* FindPkgConfig: correct library search path for imported targets.Aleksandr Mezin2018-05-021-2/+6
| | | | | | | | | | | | | | `-L` in LDFLAGS doesn't mean that standard search paths should be excluded. Example: $ pkg-config --libs libmutter-2 -L/usr/lib/mutter -lmutter-2 -lgtk-3 -lgdk-3 -lmutter-clutter-2 -lcairo-gobject -latk-1.0 -lpangocairo-1.0 -lpango-1.0 -lfribidi -ljson-glib-1.0 -lgio-2.0 -lwayland-egl -lwayland-client -lXtst -lXi -lmutter-cogl-2 -lcairo -lgmodule-2.0 -pthread -lgdk_pixbuf-2.0 -lgobject-2.0 -lglib-2.0 -lgbm -ldrm -lwayland-server -lEGL -lXext -lXdamage -lXfixes -lXcomposite -lXrandr -lX11 Most of these libraries are located at standard paths, not in `/usr/lib/mutter`. Fixes: #17954
* FindPkgConfig: do not unset unused variableRolf Eike Beer2018-04-241-1/+0
| | | | _props is never used, it was a leftover from a development step.
* FindPkgConfig: Fix IMPORTED_TARGET NO...PATH option handlingCraig Scott2017-12-161-5/+5
|
* FindPkgConfig: Cleanup docsCraig Scott2017-12-101-125/+126
| | | | | | - Moved block of misplaced comments to correct section - Improved grammar, readability and consistency - Updated to conform to style guidelines
* FindPkgConfig: On FreeBSD search in `libdata/pkgconfig`Shin-ya Murakami2017-08-071-0/+3
| | | | | | The pkgconfig dir is placed at `${PREFIX}/libdata/pkgconfig` on FreeBSD instead of `${PREFIX}/lib/pkgconfig`, where `${PREFIX}` is `/usr/local` as default.
* FindPkgConfig: do not always rerun pkg_check_modules() with 2 argumentsRolf Eike Beer2017-07-101-1/+3
| | | | | | | | | | | | | | Since commit v3.8.0-rc1~47^2 (FindPkgConfig: Recheck pkg-config on parameter change, 2017-01-17) calling `pkg_check_modules` always re-runs. The problem is that if there are only 2 arguments passed to `pkg_check_modules```, then `_module0` will be set and `ARGN` will be empty. When this is written to cache it will be stored as just the value of `_module0` without any semicolon, so on the next run this doesn't match the expected value and the search is rerun. Revise the logic to handle the case of empty `ARGN` separately. Fixes: #17003
* FindPkgConfig: mention that variables will be ;-listsRolf Eike Beer2017-06-121-0/+6
|
* FindPkgConfig: fix confusing indentationRolf Eike Beer2017-06-121-1/+1
|
* FindPkgConfig: Fix pkg_check_modules() non-standard location searchYuriy Khokhulya2017-05-121-1/+3
| | | | | | | | | | | | | | | | | During search of the library file `pkg_check_modules()` attempts to find it in last specified library path in `${_prefix}_LDFLAGS`, that after dependency resolving contains path to standard location. So in case when `${_prefix}_LDFLAGS` has: -L/prefix;-L/usr/local/lib;-llibrary_from_prefix;-ldependency `library_from_prefix` will not be found. As solution need try to find the library in all paths preceding to the library. Fixes: #16873
* Add support for x32-abiSteven Newbury2017-03-071-0/+4
| | | | | | | | Detect x32-abi through CMakeCompilerABI infrastruture and use this information at runtime to determine the correct library paths with `FIND_LIBRARY_USE_LIBX32_PATHS`. Fixes: #15994
* FindPkgConfig: use new version checking "library >= version" syntaxGautier Pelloux-Prayer2017-02-281-24/+11
| | | | Instead of the deprecated --atleast-version one.
* FindPkgConfig: Recheck pkg-config on parameter change.Matthew Hanna2017-01-241-1/+4
| | | | | | | | | Currently, once pkg_check_modules succeeds, it will never call _pkg_check_modules_internal again. That means that if the parameters to pkg_check_modules are changed, cmake will be called to reconfigure, but nothing will change. This change is to store the full string of arguments to pkg_check_modules and override the FOUND optimization so that the arguments are reevaluated when modified.
* FindPkgConfig: Fix missing error text when library version is specifiedGautier Pelloux-Prayer2016-11-281-1/+2
| | | | | | Calls like `pkg_check_modules(somelibrary>=3.22)` that specify a version requirement should still display an informative error when the package is not found. Fix our logic accordingly.
* PkgConfig: Fix FindPkgConfig imported target featureFlorent Castelli2016-11-041-1/+1
| | | | | | | The options to the find_library call to create the imported target used a literal string "HINTS /path NO_DEFAULT_PATH" instead of a list of options. This resulted in never finding any library in my testing.