Hi all.
I’m trying to cross compile a Qt program using cmake. What I’m trying to do is to force the find_package searching for a directory. From the document I read as follows:
The default search order is designed to be most-specific to least-specific for common use cases. Projects may override the order by simply calling the command multiple times and using the NO_* options:
But when I trying to do things like:
find_package(Qt5Gui ${QT_VERSION} PATHS my/directory/to/qt5guiconfig/file/Qt5Gui NO_DEFAULT_PATH)
cmake cannot find the Qt5GuiConfig.cmake file, which is locate at the path I passed to find_package.
Can anyone pls give me some hints? Thank you so much.
When CMake fails to find a package, it usually prints a message which advises you to use the CMAKE_MODULE_PATH variable.
Have you tried calling cmake with
Thanks a lot for your advise Martin. But I still do not understand one thing. The CMAKE_MODULE_PATH is used as a global variable? Can I set different path for different modules?
Thank you Ben, I do not know that the CMAKE_MODULE_PATH is a list. And about the Qt5Gui_DIR, does that mean the variable like _DIR will be automatically added to the search list for find_package?