Issue
I wanna create a project use VSCode+CMake+VCPKG(VTK+Qt5) And I still want to share my VCPKG depencies with teammate. So I export VCPKG.
When I try to find_package(Qt5 COMPONENTS Core REQUIRED)
problem happened
By not providing "FindQt5.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Qt5", but
CMake did not find one.
Could not find a package configuration file provided by "Qt5" with any of
the following names:
Qt5Config.cmake
qt5-config.cmake
Add the installation prefix of "Qt5" to CMAKE_PREFIX_PATH or set "Qt5_DIR"
to a directory containing one of the above files. If "Qt5" provides a
separate development package or SDK, be sure it has been installed.
And I try to set(Qt5_DIR "{vckpg_root_path}\installed\x64-windows\share\qt5")
There is no Qt5Config.cmake to let cmake read!!
That's what inside.
How can I exactly use Qt5 And set include file directories in cmakelist.txt?
Solution
Finally, I found how to make it Add script in CMALKELIST.txt
cmake_minimum_required(VERSION 3.0.0)
set(VCPKG_DIR "C:/vcpkg/installed/x64-windows")
set(VCPKG_TARGET_TRIPLET "x64-windows"
CACHE STRING "")
set(CMAKE_TOOLCHAIN_FILE "C:/vcpkg/scripts/buildsystems/vcpkg.cmake"
CACHE STRING "")
and to add Qt compoment, cause Qt package is divide to many bit.
So use COMPOMENTS
with Qt package you want to include.
find_package(Qt5 COMPONENTS Core Widgets CONFIG REQUIRED)
if (${Qt5Core_FOUND})
message("Found Qt " ${Qt5_VERSION})
else()
message("Couldn't find Qt")
endif()
Answered By - user7966486