summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-09-07 11:51:50 (GMT)
committerKitware Robot <kwrobot@kitware.com>2023-09-07 11:52:06 (GMT)
commit1c5e4b60b1776504fb75878dda05a5e7c862decb (patch)
tree1505a68f39fd1062c5c95d1c992def006c5d7772 /Tests
parent9fcc923c6c917b872c43769e9a88df78d107d59d (diff)
parent252c66c697e163c192938fd0ee64aacc7626ee60 (diff)
downloadCMake-1c5e4b60b1776504fb75878dda05a5e7c862decb.zip
CMake-1c5e4b60b1776504fb75878dda05a5e7c862decb.tar.gz
CMake-1c5e4b60b1776504fb75878dda05a5e7c862decb.tar.bz2
Merge topic 'FindPkgConfig-system-cflags'
252c66c697 FindPkgConfig: Tolerate PKG_CONFIG_SYSTEM_INCLUDE_PATH in environment 4507883135 Tests: Rename RunCMake.FindPkgConfig LIBRARY_PATH case to SYSTEM_PATH Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: buildbot <buildbot@kitware.com> Merge-request: !8768
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt3
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt4
-rw-r--r--Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH.cmake (renamed from Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake)8
-rw-r--r--Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake2
4 files changed, 13 insertions, 4 deletions
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt
deleted file mode 100644
index 539e5ef..0000000
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-stdout.txt
+++ /dev/null
@@ -1,3 +0,0 @@
--- ZOT_LIBRARIES='zot'
--- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib/prefix-zot-suffix'
--- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH-build/root/lib;-lzot'
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt
new file mode 100644
index 0000000..012458d
--- /dev/null
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-stdout.txt
@@ -0,0 +1,4 @@
+-- ZOT_LIBRARIES='zot'
+-- ZOT_LINK_LIBRARIES='[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/lib/prefix-zot-suffix'
+-- ZOT_LDFLAGS='-L[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/lib;-lzot'
+-- ZOT_CFLAGS='-I[^']*/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH-build/root/include'
diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH.cmake
index 1278c49..e58cefb 100644
--- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_LIBRARY_PATH.cmake
+++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_SYSTEM_PATH.cmake
@@ -3,16 +3,19 @@ find_package(PkgConfig REQUIRED)
set(ROOT "${CMAKE_CURRENT_BINARY_DIR}/root")
string(REPLACE " " "\\ " ESCAPED_ROOT "${ROOT}")
set(LIB_DIR "${ROOT}/lib")
+set(INCLUDE_DIR "${ROOT}/include")
set(PKGCONFIG_DIR "${LIB_DIR}/pkgconfig")
file(WRITE "${PKGCONFIG_DIR}/zot.pc" "
prefix=${ESCAPED_ROOT}
libdir=\${prefix}/lib
+includedir=\${prefix}/include
Name: Zot
Description: Dummy package to test LIBRARY_DIR support
Version: 1.0
Libs: -L\${libdir} -lzot
+Cflags: -I\${includedir}
")
# Create a "library" file to find in libdir.
@@ -22,9 +25,13 @@ file(WRITE "${LIB_DIR}/prefix-zot-suffix")
# 'pkg-config --libs' drops -L flags in PKG_CONFIG_SYSTEM_LIBRARY_PATH by default.
set(ENV{PKG_CONFIG_SYSTEM_LIBRARY_PATH} "${LIB_DIR}")
+# 'pkg-config --cflags' drops -I flags in PKG_CONFIG_SYSTEM_INCLUDE_PATH by default.
+set(ENV{PKG_CONFIG_SYSTEM_INCLUDE_PATH} "${INCLUDE_DIR}")
# 'pkgconf --libs' also drops -L flags in LIBRARY_PATH by default.
set(ENV{LIBRARY_PATH} "${LIB_DIR}")
+# 'pkgconf --cflags' also drops -I flags in CPATH by default.
+set(ENV{CPATH} "${INCLUDE_DIR}")
set(ENV{PKG_CONFIG_PATH} "${PKGCONFIG_DIR}")
pkg_check_modules(ZOT REQUIRED zot)
@@ -32,3 +39,4 @@ pkg_check_modules(ZOT REQUIRED zot)
message(STATUS "ZOT_LIBRARIES='${ZOT_LIBRARIES}'")
message(STATUS "ZOT_LINK_LIBRARIES='${ZOT_LINK_LIBRARIES}'")
message(STATUS "ZOT_LDFLAGS='${ZOT_LDFLAGS}'")
+message(STATUS "ZOT_CFLAGS='${ZOT_CFLAGS}'")
diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
index 6b8e884..2bfe028 100644
--- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
+++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake
@@ -59,6 +59,6 @@ Libs: -L\${libdir}
run_cmake(FindPkgConfig_GET_MATCHING_MODULE_NAME)
run_cmake(FindPkgConfig_empty_target)
if(NOT PKG_CONFIG_DONT_SUPPORT_SPACES_IN_PATH)
- run_cmake(FindPkgConfig_LIBRARY_PATH)
+ run_cmake(FindPkgConfig_SYSTEM_PATH)
endif()
endif ()