[CMake] is ccmake reliable?

John Drescher drescherjm at gmail.com
Tue Sep 15 16:52:22 EDT 2009


> Looks like the default for CMAKE_INSTALL_PREFIX comes from
> CMakeGenericSystem.cmake:
>
>
> # Set a variable to indicate whether the value of CMAKE_INSTALL_PREFIX
> # was initialized by the block below.  This is useful for user
> # projects to change the default prefix while still allowing the
> # command line to override it.
> IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
>  SET(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT 1)
> ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)
>
> IF(CMAKE_HOST_UNIX)
>  SET(CMAKE_INSTALL_PREFIX "/usr/local"
>    CACHE PATH "Install path prefix, prepended onto install directories.")
> ELSE(CMAKE_HOST_UNIX)
> [...]
>
>
> The comment above the first stanza is interesting. I guess its intended
> use is for something like this:
>
> if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>    set (CMAKE_INSTALL_PREFIX "myPrefix" CACHE FORCE ...)
> endif ()
>
>
> Maybe a more seasoned CMaker can verify if this is the Right Way to do
> what you want.
>

I am going to have to bookmark this reply since I have no time to play
with my CMakeLists files now. That would be a much better solution
than me always forcing a value like the way I posted in this thread.

Thank You.
John


More information about the CMake mailing list