The portion of the CMake file dedicated to handling pkg-config seems more complex than it should be. Look for simpler solutions.