[CMake] CMAKE_ROOT issue in scratchbox, N9(50)

Michael Wild themiwi at gmail.com
Tue Aug 9 10:29:48 EDT 2011


On Tue 09 Aug 2011 04:04:59 PM CEST, Laszlo Papp wrote:
> Hi Alex,
> 
>> Which version of cmake is this ?
>> Is this 2.8.5rcX or trunk ?
>> Then it might be the new multiarch support feature maybe.
> 
> 2.8.4 and it will probably not even change on Harmattan
> 
>> Uh.
>> The part where you install *.cmake files into ${CMAKE_ROOT}/Modules/ is really
>> bad. Remove it. You should never ever do that.
>> The user may simply use another version of cmake, then they won't be found, so
>> you can't rely on them at all in any way.
> 
> Not sure what you mean by this, but the proposed alternative way seems
> to also be a cmake version dependent deal. From the documentation:
> "...CMake 2.6 introduced support for exporting targets from one
> project and importing them into another...". However I think it is
> achievable...Not sure about the version difference aforementioned.
> 
>> FindGluon.cmake is supposed to be there, so you can rely on it and it will
>> tell you where Gluon is installed or if it's not installed.
>> It's like putting a treasure map just next to the treasure.
>> Once you find the map (or FindGluon.cmake), you already found the treaure
>> (Gluon) itself, no need to search for it anymore.
>>
>> Instead Gluon should install a GluonConfig.cmake file.
> 
> Mmm, so it seems a bit controversial to me. You mentioned that above
> it is bad if the map is nearby the treasure. However, it seems to
> still be the situation since Gluon will install it. I thought that the
> only way is that if it is independently installed from Gluon since
> that way, it exists anytime. This is still a bit confusing to me.
> Could you please clarify ? Thank you!
> 
> Best Regards,
> Laszlo Papp

What Alex tried to tell you is that you are installing the *.cmake 
files in the _wrong_ place. The install location you chose is polluting 
the CMake installation! Also, FindXXX.cmake files are intended for 
software that is _not_ built by CMake. Projects built by CMake should 
install XXXConfig.cmake files into well-defined directories (read this: 
http://www.cmake.org/cmake/help/cmake-2-8-docs.html#command:find_package, 
in particular the section about the "Config mode"). For a simple 
example, you might want to look into the Wiki: 
http://www.cmake.org/Wiki/CMake/Tutorials/How_to_create_a_ProjectConfig.cmake_file. 
However, notice that the Wiki is a bit outdated (I can say that, I 
wrote that page ;-)) in that it configures FooConfig.cmake twice, once 
for use from the build tree and once from the install tree. You can do 
without this duplication if you do some magic in FooConfig.cmake that 
detects whether it is located inside the build tree (by e.g. verifying 
whether the file CMakeCache.txt exists next to it).

HTH

Michael


More information about the CMake mailing list