1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-14 02:08:27 +08:00

Tests: Add case covering FindPkgConfig creation of empty targets

This commit is contained in:
Brad King
2021-06-04 08:30:12 -04:00
parent 26e75b474b
commit 07d6390728
3 changed files with 19 additions and 0 deletions

View File

@@ -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()

View File

@@ -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 ()

View File

@@ -0,0 +1,5 @@
Name: Empty
Description: Dummy package to test empty target
Version: 1.0
Libs:
Cflags: