[CMake] debugging CMAKE_PREFIX_PATH

Zakrzewski, Jakub Jakub.Zakrzewski at scheer-group.com
Tue Sep 12 09:15:48 EDT 2017


Hi, 

> find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED)

> I build with -DCMAKE_PREFIX_PATH set, and in CMakeCache.txt, I see:

> //No help, variable specified on the command line.
> CMAKE_PREFIX_PATH:PATH=/usr/pkg/qt5

> //The directory containing a CMake configuration file for Qt5Core.
> Qt5Core_DIR:PATH=Qt5Core_DIR-NOTFOUND

> # ls /usr/pkg/qt5/lib/cmake/Qt5Core/Qt5CoreConfig.cmake
> /usr/pkg/qt5/lib/cmake/Qt5Core/Qt5CoreConfig.cmake

> so AFAICT, Qt5CoreConfig.cmake should be found.

> What am I missing?

according to the documentation: https://cmake.org/cmake/help/v3.0/command/find_package.html
you're using the find_package() in MODULE mode, so it tries to locate a FindQt5Core.cmake.

Use this:
find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED CONFIG)

and it should do what you want.

--
Grüsse,
Jakub


More information about the CMake mailing list