[CMake] telling find_package exactly where to find a package

Alexander Neundorf a.neundorf-work at gmx.net
Tue Feb 3 15:49:19 EST 2009


On Friday 30 January 2009, Adolfo Rodríguez wrote:
...
> I have a project with similar requirements as Tyler's, and we effectively
> use the  CMAKE_PREFIX_PATH variable. The thing is that if you ONLY want the
> FindXXX.cmake to look in the paths pointed by CMAKE_PREFIX_PATH, and not
> the standard ones (e.g., /usr, /usr/local, ... on Unix), this might not be
> enough.
> FindBoost.cmake has a very convenient variable named Boost_ROOT that
> specifies where the boost libraries are located. Taking a quick look at the
> FindQt*.cmake doc, I didn't find a similar functionality, but I still
> wonder if it can be achieved in a simple way.


CMake first tries to find qmake and then uses this qmake to gather all the 
other information. So by you can e.g. adjust the PATH env. var before running 
cmake that it will find the qmake you want, or you can set 
QT_QMAKE_EXECUTABLE when running cmake:
cmake -DQT_QMAKE_EXECUTABLE=/opt/qt4/bin/qmake ...

But in general, I also recommend using CMAKE_PREFIX_PATH.

Alex


More information about the CMake mailing list