FindPkgConfig: Weird issue specific to pkg_check_module and glm
The following works fine here:
pkg_check_modules(LIB_SDL2 REQUIRED IMPORTED_TARGET sdl2)
target_link_libraries(mytarget PRIVATE PkgConfig::LIB_SDL2)
also, this works fine as well:
pkg_search_module(LIB_GLM REQUIRED glm)
target_link_libraries(mytarget PRIVATE ${LIB_GLM_LIBRARIES})
But this fails:
pkg_check_modules(LIB_GLM REQUIRED IMPORTED_TARGET glm)
target_link_libraries(mytarget PRIVATE PkgConfig::LIB_GLM)
with the following error
CMake Error at CMakeLists.txt:31 (add_executable):
Target "BreakoutTest" links to target "PkgConfig::LIB_GLM" but the target
was not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
Tested with cmake version 3.16.3 (on Ubuntu) as well as 3.18.4-1 (Arch Linux)
Edited by Brad King