diff options
author | Brad King <brad.king@kitware.com> | 2021-06-04 12:30:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2021-06-04 12:33:11 (GMT) |
commit | 07d639072800dcd189a9c461c4d1e0c04807e18f (patch) | |
tree | bb82fcb97e95c790069af09036eee3b29337018b /Tests/RunCMake/FindPkgConfig | |
parent | 26e75b474bb2b0b3216cc513cc50e91ae5dbff28 (diff) | |
download | CMake-07d639072800dcd189a9c461c4d1e0c04807e18f.zip CMake-07d639072800dcd189a9c461c4d1e0c04807e18f.tar.gz CMake-07d639072800dcd189a9c461c4d1e0c04807e18f.tar.bz2 |
Tests: Add case covering FindPkgConfig creation of empty targets
Diffstat (limited to 'Tests/RunCMake/FindPkgConfig')
3 files changed, 19 insertions, 0 deletions
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_empty_target.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_empty_target.cmake new file mode 100644 index 0000000..fd774b9 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_empty_target.cmake @@ -0,0 +1,13 @@ +# Prepare environment to reuse empty.pc +file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/pc-empty/lib/pkgconfig" PC_PATH) +if(UNIX) + string(REPLACE "\\ " " " PC_PATH "${PC_PATH}") +endif() +set(ENV{PKG_CONFIG_PATH} "${PC_PATH}") + +find_package(PkgConfig REQUIRED) +pkg_search_module(Empty REQUIRED empty IMPORTED_TARGET) + +if(NOT Empty_MODULE_NAME STREQUAL "empty") + message(FATAL_ERROR "Wrong value for Empty_MODULE_NAME. Expected: empty, got: ${Empty_MODULE_NAME}") +endif() diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 4e6eef6..e7f008c 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -29,4 +29,5 @@ if (PKG_CONFIG_FOUND) run_cmake(FindPkgConfig_IMPORTED_TARGET) run_cmake(FindPkgConfig_VERSION_OPERATORS) run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME) + run_cmake(FindPkgConfig_empty_target) endif () diff --git a/Tests/RunCMake/FindPkgConfig/pc-empty/lib/pkgconfig/empty.pc b/Tests/RunCMake/FindPkgConfig/pc-empty/lib/pkgconfig/empty.pc new file mode 100644 index 0000000..954c5f8 --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/pc-empty/lib/pkgconfig/empty.pc @@ -0,0 +1,5 @@ +Name: Empty +Description: Dummy package to test empty target +Version: 1.0 +Libs: +Cflags: |