[CMake] is ccmake reliable?

Tyler Roscoe tyler at cryptio.net
Tue Sep 15 14:59:25 EDT 2009


On Tue, Sep 15, 2009 at 12:37:27PM -0600, James C. Sutherland wrote:
> A related question:  If I set CMAKE_INSTALL_PREFIX in my  
> CMakeLists.txt file
> >set( CMAKE_INSTALL_PREFIX
> >  ${CMAKE_CURRENT_BINARY_DIR}
> >  )
> and then run ccmake, I find that the CMAKE_INSTALL_PREFIX variable is  
> set to /usr/local rather than the binary directory.  Is this a bug?  I  

There is a world of difference between set() and set(... CACHE ...).
Consult the docs.

What you've done above is set a variable that has nothing to do
with the cache, and in fact will override whatever is in the cache.
Hence:

> >  message( STATUS "Files will be installed to: " $ 
> >{CMAKE_INSTALL_PREFIX} )
> 
> then it reflects the correct directory, but the CMakeCache.txt file  

In a project configured the way you show in this email, your manually
set variable will always be used; the cache variable will always be
ignored.

tyler


More information about the CMake mailing list