[CMake] debugging CMAKE_PREFIX_PATH

Alexander Neundorf a.neundorf-work at gmx.net
Mon Oct 2 15:02:50 EDT 2017


On 2017 M09 13, Wed 09:50:48 CEST Patrick Welche wrote:
> I think I am confused by the following:
> 
> 1) CMAKE_PREFIX_PATH;
> 
> Problematic (scribus) CMakeLists.txt:
> 
>    set(CMAKE_PREFIX_PATH "${QT_PREFIX}/lib/cmake")

This looks wrong to me.
In general CMAKE_PREFIX_PATH should contain only the base install directory of 
packages, and not point into the library dir etc. So it should more look 
something like this:

 set(CMAKE_PREFIX_PATH "${QT_PREFIX}")

But actually this should be left to the user, since he knows where Qt is used 
(or is supposed to know).

> CMakeCache.txt:
> 
>   //No help, variable specified on the command line.
>   CMAKE_PREFIX_PATH:PATH=/usr/pkg/qt5
> 
> So the problem was that CMakeLists.txt overwrote the command line.
> Removing the set() line made things work

Yes. A "normal" set() call overrides values coming from the cache.

> 2) CMAKE_MODULE_PATH
> 
> CMakeLists.txt (with extras to debug):
> 
>   set (CMAKE_MODULE_PATH
> "/usr/obj/pkgsrc/print/scribus5/work.x86_64/.buildlink/cmake-Modules" "one"
> "two" "/usr/obj/pkgsrc/print/scribus5/work.x86_64/.buildlink/cmake-Modules"
> "${CMAKE_SOURCE_DIR}/cmake/modules") set(testpath ${CMAKE_MODULE_PATH}
> CACHE PATH "testing path")
> 
> CMakeCache.txt:
> 
>   //No help, variable specified on the command line.
>  
> CMAKE_MODULE_PATH:PATH=/usr/obj/pkgsrc/print/scribus5/work.x86_64/.buildlin
> k/cmake-Modules
> 
>   //testing path
>  
> testpath:PATH=/usr/obj/pkgsrc/print/scribus5/work.x86_64/.buildlink/cmake-M
> odules;one;two;/usr/obj/pkgsrc/print/scribus5/work.x86_64/.buildlink/cmake-M
> odules;/usr/obj/pkgsrc/print/scribus5/work.x86_64/scribus-1.5.3/cmake/module
> s
> 
> So here, it seems the command line overwrites CMakeLists.txt ?!

Ehm, doesn't testpath in the CMakeCache.txt have the contents of 
CMAKE_MODULE_PATH from the CMakeLists.txt ?

Alex



More information about the CMake mailing list