PkgConfig IMPORT_TARGET not working as intended for MSVC pkg-config files
CMake Error in CMakeLists.txt:
Imported target "PkgConfig::SKIA" includes non-existent path
"/IC:/Users/Administrator/test-project/out/.sysroot/x86_64-pc-windows-msvc/include/skia"
in its INTERFACE_INCLUDE_DIRECTORIES. Possible reasons include:
* The path was deleted, renamed, or moved to another location.
* An install or uninstall procedure did not complete successfully.
* The installation package was faulty and references files it does not
provide.
# CMakeLists.txt
if(MSVC)
set(PKG_CONFIG_ARGN "--msvc-syntax")
endif()
find_package(PkgConfig REQUIRED)
pkg_check_modules(SKIA REQUIRED IMPORTED_TARGET GLOBAL skia=109)
add_executable(test-project test-project.cpp)
target_link_libraries(test-project PUBLIC PkgConfig::SKIA)
The skia.pc file
prefix=${pcfiledir}/../..
libdir=${prefix}/lib
includedir=${prefix}/include/skia
Name: skia
Description: Skia is a complete 2D graphic library for drawing Text, Geometries, and Images.
Cflags: -I${includedir} -DSK_HAS_ANDROID_CODEC -DSKSL_ENABLE_TRACING -DSK_ENABLE_SPIRV_VALIDATION -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DWIN32_LEAN_AND_MEAN -DNOMINMAX -DSK_ENABLE_SKSL -DSK_ENABLE_PRECOMPILE -DSK_GAMMA_APPLY_TO_A8 -DSK_ALLOW_STATIC_GLOBAL_INITIALIZERS=1 -DGR_TEST_UTILS=1 -DSKIA_IMPLEMENTATION=1 -DSK_DIRECT3D -DSK_ENABLE_D3D_DEBUG_LAYER -DSK_ENABLE_DUMP_GPU -DSK_SUPPORT_GPU=1 -DSK_ENABLE_SPIRV_CROSS -DSK_SUPPORT_PDF -DSK_CODEC_DECODES_JPEG -DSK_ENCODE_JPEG -DSK_SUPPORT_XPS -DSK_HAS_HEIF_LIBRARY -DSK_CODEC_DECODES_PNG -DSK_ENCODE_PNG -DSKVM_JIT_WHEN_POSSIBLE -DSK_CODEC_DECODES_WEBP -DSK_ENCODE_WEBP -DSK_HAS_WUFFS_LIBRARY -DSK_XML
Libs: /LIBPATH:${libdir} skia.lib
Libs.private: /LIBPATH:${libdir} DXGI.lib
Version: 109
Seems like cmake is not segregating the /I returned from pkg-config? I can confirm that the path "C:/Users/Administrator/test-project/out/.sysroot/x86_64-pc-windows-msvc/include/skia" exists in disk.