Просмотр исходного кода

Merge topic 'tests-FindPkgConfig'

fc8f8d82f2 Tests: Disable parts of FindPkgConfig tests without wide supported
96d7b5a6d1 Tests: pkg_check_modules() doesn't allow spaces in a moduleSpec
afd1b28cea Tests: Disable broken FindPkgConfig test cases for Windows

Acked-by: Kitware Robot <[email protected]>
Acked-by: buildbot <[email protected]>
Merge-request: !7847
Brad King 3 лет назад
Родитель
Сommit
46c1693602

+ 25 - 15
Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake

@@ -113,23 +113,33 @@ message(STATUS "Verifying target \"${tgt}\"")
 if (NOT TARGET ${tgt})
   message(FATAL_ERROR "No import target for fake link options package")
 endif()
-get_target_property(link_options ${tgt} INTERFACE_LINK_OPTIONS)
-if (NOT link_options STREQUAL expected_link_options)
-  message(FATAL_ERROR
-    "Additional link options not present in INTERFACE_LINK_OPTIONS property\n"
-    "expected: \"${expected_link_options}\", but got \"${link_options}\""
-  )
-endif()
 
-get_target_property(inc_dirs ${tgt} INTERFACE_INCLUDE_DIRECTORIES)
-set(expected_inc_dirs "/special" "/other" "/more")
+# Some versions of pkg-config on Windows don't parse the Libs and Cflags
+# correctly. The pkg-config that comes with Strawberry perl is one example.
+# It appears to treat the dummymain part of Libs as a library and only returns
+# -e. It also doesn't recognize "-isystem /other", presumably because it doesn't
+# support having a space between "-isystem" and the directory after it (it does
+# give us the "-isystem/more" flag). Since we can't reliably test for these,
+# we don't enable these checks on Windows.
+if(NOT WIN32)
+  get_target_property(link_options ${tgt} INTERFACE_LINK_OPTIONS)
+  if (NOT link_options STREQUAL expected_link_options)
+    message(FATAL_ERROR
+      "Additional link options not present in INTERFACE_LINK_OPTIONS property\n"
+      "expected: \"${expected_link_options}\", but got \"${link_options}\""
+    )
+  endif()
 
-if (NOT inc_dirs STREQUAL expected_inc_dirs)
-  message(FATAL_ERROR
-    "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n"
-    "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\""
-  )
-endif ()
+  get_target_property(inc_dirs ${tgt} INTERFACE_INCLUDE_DIRECTORIES)
+  set(expected_inc_dirs "/special" "/other" "/more")
+
+  if (NOT inc_dirs STREQUAL expected_inc_dirs)
+    message(FATAL_ERROR
+      "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n"
+      "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\""
+    )
+  endif ()
+endif()
 
 get_target_property(c_opts ${tgt} INTERFACE_COMPILE_OPTIONS)
 set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase

+ 11 - 10
Tests/RunCMake/FindPkgConfig/FindPkgConfig_VERSION_OPERATORS.cmake

@@ -20,14 +20,15 @@ Libs: -lcmakeinternalfakepackage
 
 # Always find the .pc file in the calls further below so that we can test that
 # the import target find_library() calls handle the NO...PATH options correctly
-set(ENV{PKG_CONFIG_PATH} ${fakePkgDir}/lib/pkgconfig)
+cmake_path(CONVERT "${fakePkgDir}/lib/pkgconfig" TO_NATIVE_PATH_LIST confPath)
+set(ENV{PKG_CONFIG_PATH} "${confPath}")
 
-pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage >= 8")
+pkg_check_modules(FakePackageGE REQUIRED QUIET "cmakeinternalfakepackage>=8")
 if (NOT FakePackageGE_FOUND)
   message(FATAL_ERROR "fake package >= 8 not found")
 endif()
 
-pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage >= 8.10")
+pkg_check_modules(FakePackageGE_FAIL QUIET "cmakeinternalfakepackage>=8.10")
 if (FakePackageGE_FAIL_FOUND)
   message(FATAL_ERROR "fake package >= 8.10 found")
 endif()
@@ -37,17 +38,17 @@ if (NOT FakePackageLE_FOUND)
   message(FATAL_ERROR "fake package <= 9 not found")
 endif()
 
-pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage <= 8.1")
+pkg_check_modules(FakePackageLE_FAIL QUIET "cmakeinternalfakepackage<=8.1")
 if (FakePackageLE_FAIL_FOUND)
   message(FATAL_ERROR "fake package <= 8.1 found")
 endif()
 
-pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage > 8")
+pkg_check_modules(FakePackageGT REQUIRED QUIET "cmakeinternalfakepackage>8")
 if (NOT FakePackageGT_FOUND)
   message(FATAL_ERROR "fake package > 8 not found")
 endif()
 
-pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage > 8.9")
+pkg_check_modules(FakePackageGT_FAIL QUIET "cmakeinternalfakepackage>8.9")
 if (FakePackageGT_FAIL_FOUND)
   message(FATAL_ERROR "fake package > 8.9 found")
 endif()
@@ -57,7 +58,7 @@ if (NOT FakePackageLT_FOUND)
   message(FATAL_ERROR "fake package < 9 not found")
 endif()
 
-pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage < 8.9")
+pkg_check_modules(FakePackageLT_FAIL QUIET "cmakeinternalfakepackage<8.9")
 if (FakePackageLT_FAIL_FOUND)
   message(FATAL_ERROR "fake package < 8.9 found")
 endif()
@@ -67,17 +68,17 @@ if (NOT FakePackageEQ_FOUND)
   message(FATAL_ERROR "fake package = 8.9 not found")
 endif()
 
-pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage = 8.8")
+pkg_check_modules(FakePackageEQ_FAIL QUIET "cmakeinternalfakepackage=8.8")
 if (FakePackageEQ_FAIL_FOUND)
   message(FATAL_ERROR "fake package = 8.8 found")
 endif()
 
-pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage == 8.9")
+pkg_check_modules(FakePackageEQ_INV QUIET "cmakeinternalfakepackage==8.9")
 if (FakePackageEQ_FAIL_FOUND)
   message(FATAL_ERROR "fake package == 8.9 found")
 endif()
 
-pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage <<= 9")
+pkg_check_modules(FakePackageLLT_INV QUIET "cmakeinternalfakepackage<<=9")
 if (FakePackageLLT_FAIL_FOUND)
   message(FATAL_ERROR "fake package <<= 9 found")
 endif()

+ 11 - 6
Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake

@@ -7,13 +7,18 @@ set(ENV{CMAKE_FRAMEWORK_PATH} "")
 
 run_cmake(PkgConfigDoesNotExist)
 
-run_cmake(FindPkgConfig_CMP0126_NEW)
-run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH)
-run_cmake(FindPkgConfig_PKGCONFIG_PATH)
-run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH)
-run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH)
+if(NOT WIN32)
+  # FIXME: The Windows implementation of these tests do not work.
+  #        They are disabled until they can be updated to a working state.
+  run_cmake(FindPkgConfig_CMP0126_NEW)
+  run_cmake(FindPkgConfig_NO_PKGCONFIG_PATH)
+  run_cmake(FindPkgConfig_PKGCONFIG_PATH)
+  run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_PATH)
+  run_cmake(FindPkgConfig_PKGCONFIG_PATH_NO_CMAKE_ENVIRONMENT_PATH)
+  run_cmake(FindPkgConfig_GET_MATCHING_ARGN)
+endif()
+
 run_cmake(FindPkgConfig_extract_frameworks)
-run_cmake(FindPkgConfig_GET_MATCHING_ARGN)
 
 if(APPLE)
   run_cmake(FindPkgConfig_extract_frameworks_target)