summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FindPkgConfig
Commit message (Collapse)AuthorAgeFilesLines
* Tests: Disable parts of FindPkgConfig tests without wide supportedCraig Scott2022-10-291-15/+25
| | | | | | | | | | Some pkg-config implementations on Windows don't return the same results as those on other platforms. They appear to be bugs in those implementations, the one that comes with Strawberry perl being one case where this was observed. The handling of Libs and Cflags entries is incomplete, resulting in some flags not being reported where they should be. These are faults in the pkg-config implementation, not in CMake or its tests, so we disable those parts of the tests on Windows to avoid reporting false positives.
* Tests: pkg_check_modules() doesn't allow spaces in a moduleSpecCraig Scott2022-10-291-10/+11
| | | | | | | | | The documentation of pkg_check_modules() is a little ambiguous about whether spaces are allowed in a moduleSpec that includes a version constraint. All examples in the docs do not have spaces, so it could be claimed spaces are not supported. The tests fail on Windows when spaces are included, likely because some pkg-config implementations don't support that. Update the tests to not assume spaces are supported as part of a moduleSpec.
* Tests: Disable broken FindPkgConfig test cases for WindowsCraig Scott2022-10-291-6/+11
| | | | | | | | | The Windows implementation of these tests have been found to not handle Windows paths and path separators properly in a number of areas. The whole approach taken in these tests appears dubious, so they may need to be significantly rewritten. Disable them until then so we don't get false positives. Issue: #22031
* Tests/FindPkgConfig: correctly handle broken pkg-configmakise-homura2022-07-011-1/+24
| | | | | | | | | Older versions of pkg-config (e.g. 0.21 and 0.22) do not handle correctly spaces in paths specified in .pc files. It breaks RunCMake.FindPkgConfig test, if CMake is built inside path containing spaces. In this case, we check if we're inside such path, and if pkg-config is broken; and if both are true, test is to be skipped.
* FindPkgConfig: Revert "Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET."Brad King2022-06-227-203/+72
| | | | | | | | | | 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
* FindPkgConfig: Populate _STATIC_LINK_LIBRARIES. Add STATIC_TARGET.Alex Birch2022-05-207-72/+203
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Tests: De-duplicate some code in RunCMake.FindPkgConfigAlex Birch2022-05-201-8/+14
|
* FindPkgConfig: Fix parsing of backslash-escaped spaces in pkg-config outputAlex Birch2022-05-123-13/+15
| | | | | | | | 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.
* Merge topic 'FindPkgConfig-restore-legacy-behavior'Brad King2021-08-192-0/+65
|\ | | | | | | | | | | | | 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-182-0/+65
| | | | | | | | | | | | Module behavior must be independent from `CMP0126` policy. Fixes: #22526
* | FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_LIBRARY_PATH in environmentBrad King2021-07-133-0/+36
| | | | | | | | | | | | | | | | 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: split args if loaded from environmentChristopher Degawa2021-06-184-0/+54
|/ | | | | | | | | | | | | | | 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-0/+4
| | | | Fixes: #22180
* Tests: Add case covering FindPkgConfig creation of empty targetsBrad King2021-06-043-0/+19
|
* Merge topic 'test-FindPkgConfig-isolate-env'Brad King2020-08-101-0/+5
|\ | | | | | | | | | | | | | | | | 8b12982653 Merge branch 'backport-test-FindPkgConfig-isolate-env' 4c939b0d39 Tests: Isolate RunCMake.FindPkgConfig from caller environment 20eeb40aaf Tests: Isolate RunCMake.FindPkgConfig from caller environment Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5108
| * Tests: Isolate RunCMake.FindPkgConfig from caller environmentBrad King2020-08-071-0/+5
| | | | | | | | | | Avoid interference from `CMAKE_PREFIX_PATH` and friends if they happen to be set in the environment from which the tests are run.
* | Fix typos identified using codespellJean-Christophe Fillion-Robin2020-07-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See https://github.com/codespell-project/codespell#readme The following command was used: ``` codespell -q6 --skip="\ .git,\ *.json,\ ./Copyright.txt,\ ./Help/command/foreach.rst,\ ./Help/prop_test/REQUIRED_FILES.rst,\ ./Help/variable/CTEST_COVERAGE_COMMAND.rst,\ ./Modules/CMakeCheckCompilerFlagCommonPatterns.cmake,\ ./Modules/CMakeRCInformation.cmake,\ ./Modules/Internal/CPack/NSIS.template.in,\ ./Modules/FindMatlab.cmake,\ ./Modules/MatlabTestsRedirect.cmake,\ ./Modules/Platform/Windows-Clang.cmake,\ ./Modules/Platform/Windows-Intel-Fortran.cmake,\ ./Modules/Platform/Windows-MSVC.cmake,\ ./Source/CMakeVersion.cmake,\ ./Source/cmConvertMSBuildXMLToJSON.py,\ ./Source/cmCreateTestSourceList.cxx,\ ./Source/cmGlobalVisualStudio10Generator.cxx,\ ./Source/cmExportBuildFileGenerator.cxx,\ ./Source/cmExportInstallAndroidMKGenerator.cxx,\ ./Source/cmExportInstallFileGenerator.cxx,\ ./Source/cmExportSet.cxx,\ ./Source/cmExportTryCompileFileGenerator.cxx,\ ./Source/cmFindPackageCommand.cxx,\ ./Source/cmInstallCommand.cxx,\ ./Source/cmGeneratorExpressionLexer.cxx,\ ./Source/cmLocalVisualStudio7Generator.cxx,\ ./Source/cmOrderDirectories.cxx,\ ./Source/cmTarget.cxx,\ ./Source/kwsys/*,\ ./Source/QtDialog/CMakeSetupDialog.ui,\ ./Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx,\ ./Source/CTest/cmParseCoberturaCoverage.h,\ ./Tests/CMakeTests/ImplicitLinkInfoTest.cmake.in,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/English.license.rtf,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.license.txt,\ ./Tests/RunCMake/CPack/tests/DMG_SLA/German.menu.txt,\ ./Tests/RunCMake/GoogleTest/xml_output.cpp,\ ./Tests/RunCMake/Make/TargetMessages*,\ ./Utilities/*,\ " \ -L "\ dependees,\ endwhile,\ fo,\ filetest,\ helpfull,\ nd,\ objext,\ stoll,\ supercedes,\ superceded,\ vas,\ varn,\ " ```
* | Tests/RunCMake: Update cmake_minimum_required versionsBrad King2020-06-181-1/+1
|/ | | | Use 3.3 or 2.8.12 where possible.
* FindPkgConfig: also handle "-isystem" prefixes for include directoriesRolf Eike Beer2020-05-051-1/+21
| | | | Fixes: #20652
* FindPkgConfig: fix handling of frameworksRolf Eike Beer2020-04-184-0/+53
|
* Tests: simplify FindPkgConfig_CMAKE_{FRAMEWORK,APPBUNDLE}_PATH testsRolf Eike Beer2020-04-182-88/+8
| | | | | These tests are only run on Apple platforms, so remove code for all other platforms form them.
* FindPkgConfig: Add test for specified pkg-config tool missingBrad King2020-03-173-0/+12
|
* FindPkgConfig: Allow libraries that can't be found with their full pathChuck Atkins2019-09-161-33/+16
| | | | | | | | | | | | 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-292-0/+29
| | | | | | | | | | 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-2/+1
| | | | Fixes: #15805
* More tests for pkg_get_variableDan Kegel2019-03-204-0/+57
| | | | Issue: #15805
* FindPkgConfig: Set linker flags on imported targetsRadek Nadstawny2019-03-131-0/+21
|
* FindPkgConfig: support also > and < operators for version comparesRolf Eike Beer2018-10-042-0/+84
| | | | Fixes: #18416
* FindPkgConfig: allow to create global imported targetsRolf Eike Beer2018-07-222-1/+18
|
* FindPkgConfig: export the list of found libraries also as variableRolf Eike Beer2018-05-111-0/+12
|
* Various typo fixesLuz Paz2018-01-031-1/+1
| | | | Some are user-facing. Others are source comments.
* FindPkgConfig: Make IMPORTED_TARGET test verify NO...PATH properlyCraig Scott2017-12-161-0/+61
|
* Tests: Add x32 tests to test suiteSteven Newbury2017-03-087-5/+20
|
* FindPkgConfig: use new version checking "library >= version" syntaxGautier Pelloux-Prayer2017-02-282-16/+27
| | | | Instead of the deprecated --atleast-version one.
* Teach find_library and find_package to search lib32 paths (#11260)Daniel Scharrer2016-06-108-18/+40
| | | | | | | Add a ``FIND_LIBRARY_USE_LIB32_PATHS`` global property analogous to the ``FIND_LIBRARY_USE_LIB64_PATHS`` property. This helps find commands on multilib systems that use ``lib32`` directories and either do not have ``lib`` symlinks or point ``lib`` to ``lib64``.
* FindPkgConfig: optionally create imported target for the found librariesRolf Eike Beer2016-05-142-0/+27
|
* FindPkgConfig: set correctly named variables in cache (#15903)Ben Boeckel2016-03-211-5/+6
| | | | | | | | | | The fix in commit v3.5.0-rc1~27^2 (FindPkgConfig: set standard variables in the cache, 2016-01-20) added the wrong variable name to the cache. The test was only testing that the cache variable existed, not that it also had the correct value. Update the test to ensure that the cache value matches the local variable value. Reported-by: Bernd Lörwald
* FindPkgConfig: set standard variables in the cacheBen Boeckel2016-01-212-0/+17
| | | | | | | | | Fixes a regression introduced when the code was simplified to use the variable queries. Fixes #15903. Reported-by: Bernd Lörwald
* FindPkgConfig: return actual error when a package is not found (#15810)Benjamin Chrétien2015-10-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some cases, CMake returned the following error: -- Checking for module 'foo' -- Package 'foo' not found When the actual error returned by pkg-config was: Package 'bar', required by 'foo', not found Now, the actual error is forwarded to the user. -- Checking for module 'foo' -- Package 'bar', required by 'foo', not found For the standard case (i.e. the package was indeed not found), the CMake error was: -- Checking for module 'foo' -- Package 'foo' not found But it now prints: -- Checking for module 'foo' -- No package 'foo' found The associated test was also updated. ${last} refers to the last CLI argument.
* FindPkgConfig: add a command to query arbitrary variablesBen Boeckel2015-09-213-0/+16
|
* FindPkgConfig: Fix extra paths for CMAKE_{FRAMEWORK,APPBUNDLE}_PATH varsDaniele E. Domenichelli2015-05-293-0/+107
| | | | | | | | The CMAKE_FRAMEWORK_PATH and CMAKE_APPBUNDLE_PATH cache variables are supposed to be used to generate the extra paths passed to pkg-config, but instead the CMAKE_PREFIX_PATH variable is used. This bug was introduced by the refactor in commit v3.1.0-rc1~747^2~1.
* Tests: Fix CMP0054 warningsBrad King2014-09-164-5/+5
| | | | | Hack the CMP0054 warning locally to be an error and run the test suite. Resolve CMP0054 in Tests/* code as appropriate for each case.
* FindPkgConfig: More unit testsDaniele E. Domenichelli2014-03-177-3/+151
|
* FindPkgConfig: Extend PKG_CONFIG_PATH using CMake variables (#12926)Daniele E. Domenichelli2014-03-1713-0/+93
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.