'Unknown CMake command "pkg_check_modules"' - Jami-Client-Qt

-- Compiling with qtwrapper
Adding pluginmanager.cpp
CMake Error at src/libclient/CMakeLists.txt:479 (pkg_check_modules):
  Unknown CMake command "pkg_check_modules".


-- Configuring incomplete, errors occurred!

pkg_check_modules(XCB xcb IMPORTED_TARGET)

./CMakeLists.txt:

157: set(LIBCLIENT_SRC_DIR ${PROJECT_SOURCE_DIR}/src/libclient)
188: add_subdirectory(${LIBCLIENT_SRC_DIR})
486: find_package(PkgConfig REQUIRED)

Is that find_package meant to be AFTER the CMakeLists for libclient is processed?

I traced the cmake and saw jami-client-qt/CMakeLists.txt(188): add_subdirectory(${LIBCLIENT_SRC_DIR} ) was the last line in that file to be processed before erroring at the jami-client-qt/src/libclient/CMakeLists.txt(478): if(NOT ( APPLE OR MSVC ) ) part.

I moved line 486 right before line 188, and cmake got past that (dealing with a qt5+6 side-by-side issue now).