Disabling PkgConfig causes error when finding modules invokes it
I want to configure the build with system libraries (they perfectly found by FindXXX modules). However, on one of the system pkg-config is installed, it hints about another libs, and finally it crashes the build with strange errors.
The simplest way to achieve a build is to deactivate or even uninstall pkg-config. But of course it is not so good in global scope.
Another way - define "CMAKE_DISABLE_FIND_PACKAGE_PkgConfig" as "ON". (have tried SET (PKG_CONFIG_FOUND FALSE) and even with ..CACHE FORCE and CACHE INTERNAL - no success). I use this method, but immediately hit with the issue: configuration fails with error - in my case 'Unknown CMake command "pkg_check_modules".' - because in all the FindXXX which uses pkgconfig the next command after find_package(PkgConfig) is invoking one of the macro/function defined there.
For the moment I hit the problem with small snippet:
macro( pkg_check_modules ) endmacro()
just after I "SET ( CMAKE_DISABLE_FIND_PACKAGE_PkgConfig ON )" If solved the problem for me, however it still may be so if finding of a package invokes another macros from there.
I think it would be good to have a mechanism which can not just disable to find the module at all, but set the result to 'not found' - with all implicitly defined essences still active.