summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/FindPkgConfig
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-06-04 12:30:12 (GMT)
committerBrad King <brad.king@kitware.com>2021-06-04 12:33:11 (GMT)
commit07d639072800dcd189a9c461c4d1e0c04807e18f (patch)
treebb82fcb97e95c790069af09036eee3b29337018b /Tests/RunCMake/FindPkgConfig
parent26e75b474bb2b0b3216cc513cc50e91ae5dbff28 (diff)
downloadCMake-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')
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_empty_target.cmake13
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake1
-rw-r--r--Tests/RunCMake/FindPkgConfig/pc-empty/lib/pkgconfig/empty.pc5
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: