[CMake] About CMAKE_INSTALL_PREFIX - solved

pellegrini pellegrini at ill.fr
Tue Jan 24 03:54:05 EST 2012


Great, thanks a lot Rolf & Michael

Rolf Eike Beer a écrit :
>> Hello everbody,
>>
>> I would like to understand a bit more one feature related to
>> CMAKE_INSTALL_PREFIX initialization.
>>
>> When reading the documentation, it is specified that this variable
>>     
> contains the directory that will be pre-pended to all install
>   
>> directories and that it should be defaulted to C:/Program Files on
>>     
> Windows. However, in my current build the variable is not defaulted to
> C:/Program Files but to C:/Program Files/libcrysfml where "crysfml " is
> the name of my base project.
>   
>> This unexpected feature (at least to my understanding !) leads me to my
>>     
> second question.
>   
>> I would like to get rid of the "crysfml " subdirectory in the value of
>>     
> CMAKE_INSTALL_PREFIX. I could obvioulsy
>   
>> use:
>>     get_filename_component(MY_CMAKE_INSTALL_PREFIX
>> ${CMAKE_INSTALL_PREFIX} PATH)
>> but this would fail if CMAKE_INSTALL_PREFIX is set on the cmake command
>>     
> line by the user because, in such case, the installation will not be
> done in the directory that he provided but in its parent directory.
> Rather counter-intuitive.
>   
>> What I would need is a mechanism to detect whether the
>> CMAKE_INSTALL_PREFIX has been set or not by the user on the
>> command-line. If so, I take directly the values he provided, and if not
>>     
> so, I take the parent directory of the default value.
>   
>> Is that possible ?
>>     
>
> if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>  ...
> endif ()
>
> Eike
>
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>   


-- 
Eric Pellegrini
Calcul Scientifique
Institut Laue-Langevin
Grenoble, France



More information about the CMake mailing list