Re: [CMake] is ccmake reliable?

2009-09-16 Thread Atwood, Robert (DLSLtd,RAL,DIA)

Thanks also , that's what I want to do as well! 

 

-Original Message-
From: cmake-boun...@cmake.org [mailto:cmake-boun...@cmake.org] On Behalf
Of James C. Sutherland
Sent: 16 September 2009 00:34
To: CMake List
Subject: Re: [CMake] is ccmake reliable?


On Sep 15, 2009, at 2:47 PM, Tyler Roscoe wrote:

> On Tue, Sep 15, 2009 at 02:20:35PM -0600, James C. Sutherland wrote:
>>>>> set( CMAKE_INSTALL_PREFIX
>>>>> ${CMAKE_CURRENT_BINARY_DIR}
>>>>> CACHE PATH "installation path"
>>>>> )
>>>> This doesn't work - I assume that this is because 
>>>> CMAKE_INSTALL_PREFIX is a special (internally defined) variable?  
>>>> When I run ccmake and configure, the value remains as /usr/local.
>
> 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 ()
>

if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set (CMAKE_INSTALL_PREFIX
 ${CMAKE_CURRENT_BINARY_DIR}
 CACHE PATH "" FORCE
 )
endif()

This did what I want.  It sets the default value for what I want, and
allows the user to reset it when running ccmake.

Thanks for the tips!

James
___
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
This e-mail and any attachments may contain confidential, copyright and or 
privileged material, and are for the use of the intended addressee only. If you 
are not the intended addressee or an authorised recipient of the addressee 
please notify us of receipt by returning the e-mail and do not use, copy, 
retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not 
necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments 
are free from viruses and we cannot accept liability for any damage which you 
may sustain as a result of software viruses which may be transmitted in or with 
the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and 
Wales with its registered office at Diamond House, Harwell Science and 
Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom
 
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread James C. Sutherland


On Sep 15, 2009, at 2:47 PM, Tyler Roscoe wrote:


On Tue, Sep 15, 2009 at 02:20:35PM -0600, James C. Sutherland wrote:

set( CMAKE_INSTALL_PREFIX
${CMAKE_CURRENT_BINARY_DIR}
CACHE PATH "installation path"
)

This doesn't work - I assume that this is because
CMAKE_INSTALL_PREFIX
is a special (internally defined) variable?  When I run ccmake and
configure, the value remains as /usr/local.


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 ()



if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
  set (CMAKE_INSTALL_PREFIX
${CMAKE_CURRENT_BINARY_DIR}
CACHE PATH "" FORCE
)
endif()

This did what I want.  It sets the default value for what I want, and  
allows the user to reset it when running ccmake.


Thanks for the tips!

James
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread John Drescher
> 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
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread Tyler Roscoe
On Tue, Sep 15, 2009 at 02:20:35PM -0600, James C. Sutherland wrote:
> >>>set( CMAKE_INSTALL_PREFIX
> >>>${CMAKE_CURRENT_BINARY_DIR}
> >>>CACHE PATH "installation path"
> >>>)
> >>This doesn't work - I assume that this is because  
> >>CMAKE_INSTALL_PREFIX
> >>is a special (internally defined) variable?  When I run ccmake and
> >>configure, the value remains as /usr/local.
> >
> >This will work when generating a new cache. If you have a pre-existing
> >cache, CMake won't override the value in there (otherwise how could a
> >user ever provide her own values for cache variables).
> >
> After wiping my cache (and the entire build directory) clean, I ran  
> ccmake (configure) and the CMAKE_INSTALL_PREFIX was set to /usr/ 
> local.  The only way I can get it to modify the CMAKE_INSTALL_PREFIX  
> by default (i.e. through the CMakeLists.txt file) is by removing the  
> CACHE PATH portion.  But then it isn't cached (obviously).

Yeah, duh, sorry. The problem is that CMake does something like the
above by default, so your later set(... CACHE ...) has no effect because
a value is already set in the cache.

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.

hth,
tyler
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread James C. Sutherland


On Sep 15, 2009, at 12:59 PM, Tyler Roscoe wrote:


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


Thanks for the tip.

So assuming that I wanted my CMakeLists.txt file to modify the default  
install location, but allow the user to change this, wouldn't I do  
something like:

set( CMAKE_INSTALL_PREFIX
 ${CMAKE_CURRENT_BINARY_DIR}
 CACHE PATH "installation path"
 )
This doesn't work - I assume that this is because CMAKE_INSTALL_PREFIX  
is a special (internally defined) variable?  When I run ccmake and  
configure, the value remains as /usr/local.

___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread James C. Sutherland


On Sep 15, 2009, at 2:15 PM, Tyler Roscoe wrote:


On Tue, Sep 15, 2009 at 02:08:44PM -0600, James C. Sutherland wrote:
So assuming that I wanted my CMakeLists.txt file to modify the  
default

install location, but allow the user to change this, wouldn't I do
something like:

set( CMAKE_INSTALL_PREFIX
${CMAKE_CURRENT_BINARY_DIR}
CACHE PATH "installation path"
)
This doesn't work - I assume that this is because  
CMAKE_INSTALL_PREFIX

is a special (internally defined) variable?  When I run ccmake and
configure, the value remains as /usr/local.


This will work when generating a new cache. If you have a pre-existing
cache, CMake won't override the value in there (otherwise how could a
user ever provide her own values for cache variables).

After wiping my cache (and the entire build directory) clean, I ran  
ccmake (configure) and the CMAKE_INSTALL_PREFIX was set to /usr/ 
local.  The only way I can get it to modify the CMAKE_INSTALL_PREFIX  
by default (i.e. through the CMakeLists.txt file) is by removing the  
CACHE PATH portion.  But then it isn't cached (obviously).

___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread Tyler Roscoe
On Tue, Sep 15, 2009 at 02:08:44PM -0600, James C. Sutherland wrote:
> So assuming that I wanted my CMakeLists.txt file to modify the default  
> install location, but allow the user to change this, wouldn't I do  
> something like:
> >set( CMAKE_INSTALL_PREFIX
> > ${CMAKE_CURRENT_BINARY_DIR}
> > CACHE PATH "installation path"
> > )
> This doesn't work - I assume that this is because CMAKE_INSTALL_PREFIX  
> is a special (internally defined) variable?  When I run ccmake and  
> configure, the value remains as /usr/local.

This will work when generating a new cache. If you have a pre-existing
cache, CMake won't override the value in there (otherwise how could a
user ever provide her own values for cache variables).

You can use FORCE to overcome this, but it usually isn't what you want.

tyler
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread John Drescher
> So assuming that I wanted my CMakeLists.txt file to modify the default
> install location, but allow the user to change this, wouldn't I do something
> like:
>>
>> set( CMAKE_INSTALL_PREFIX
>>  ${CMAKE_CURRENT_BINARY_DIR}
>>  CACHE PATH "installation path"
>>  )
>
> This doesn't work - I assume that this is because CMAKE_INSTALL_PREFIX is a
> special (internally defined) variable?  When I run ccmake and configure, the
> value remains as /usr/local.

Here is what I do in my cuurent project:

IF(WIN32)

#The following command changes \ to / in the Program Files Path so
CMake will not complain
#about bad escape sequences.
IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
string (REPLACE "\\" "/" PGM_FILES $ENV{PROGRAMFILES})
ELSE(CMAKE_SIZEOF_VOID_P MATCHES 4)
# On WIN64 use the 64 bit program files..
string (REPLACE "\\" "/" PGM_FILES $ENV{ProgramW6432})
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)

SET (CMAKE_INSTALL_PREFIX ${PGM_FILES}/UPMC/${CMAKE_PROJECT_NAME}
CACHE STRING "Default Install Path" FORCE)

configure_file (
"${PROJECT_SOURCE_DIR}/install.bat.in"
"${PROJECT_BINARY_DIR}/Batch/install.bat"
)

ENDIF(WIN32)

John
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread James C. Sutherland



On Sep 15, 2009, at 12:50 PM, David Cole wrote:

I believe the word used was "reproducible" not "reliable" -- and I  
think he was talking about the fact that it is not reproducible  
because it depends on human interaction. Other than the human  
sitting at the keyboard, I have found ccmake (and *all* of the cmake  
executables) to be quite reliable.


The thing that is confusing you about the CMAKE_INSTALL_PREFIX value  
is something that it takes everyone a while to get their heads  
around... The *cached* value (that you see in the GUI) is not the  
same as the local variable value in the CMakeLists.txt file. When  
you use set(var "value") in a CMakeLists.txt file using a variable  
name that is also in the cache, you are only affecting the local  
value in the CMakeLists.txt file, not the cache value.


And when you print it out (and when CMake generates make files) it  
is the local value that matters, not the cached value that you see  
in the GUI.


Once you get your head around that concept, I think you'll find  
ccmake is quite reliable. :-)




Thanks, that does help.  And you are right that the word was  
"reproducible" and not "reliable."


___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread Tyler Roscoe
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
___
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


Re: [CMake] is ccmake reliable?

2009-09-15 Thread David Cole
I believe the word used was "reproducible" not "reliable" -- and I think he
was talking about the fact that it is not reproducible because it depends on
human interaction. Other than the human sitting at the keyboard, I have
found ccmake (and *all* of the cmake executables) to be quite reliable.
The thing that is confusing you about the CMAKE_INSTALL_PREFIX value is
something that it takes everyone a while to get their heads around... The
*cached* value (that you see in the GUI) is not the same as the local
variable value in the CMakeLists.txt file. When you use set(var "value") in
a CMakeLists.txt file using a variable name that is also in the cache, you
are only affecting the local value in the CMakeLists.txt file, not the cache
value.

And when you print it out (and when CMake generates make files) it is the
local value that matters, not the cached value that you see in the GUI.

Once you get your head around that concept, I think you'll find ccmake is
quite reliable. :-)


HTH,
David




On Tue, Sep 15, 2009 at 2:37 PM, James C. Sutherland <
james.sutherl...@utah.edu> wrote:

> On another mailing list that I subscribe to someone mentioned that ccmake
> was not very reliable.  Is this true?
>
> 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 ran
> ccmake on a clean build directory, i.e. I had no cache.  Incidentally, this
> also occurs with the CMake gui.  If I dump the variable from my
> CMakeLists.txt file, e.g.
>
>>  message( STATUS "Files will be installed to: " ${CMAKE_INSTALL_PREFIX} )
>>
>
> then it reflects the correct directory, but the CMakeCache.txt file still
> shows /usr/local.  Am I misunderstanding something?
>
> Thanks,
>
> James
>
> ___
> 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
>
___
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

[CMake] is ccmake reliable?

2009-09-15 Thread James C. Sutherland
On another mailing list that I subscribe to someone mentioned that  
ccmake was not very reliable.  Is this true?


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  
ran ccmake on a clean build directory, i.e. I had no cache.   
Incidentally, this also occurs with the CMake gui.  If I dump the  
variable from my CMakeLists.txt file, e.g.
  message( STATUS "Files will be installed to: " $ 
{CMAKE_INSTALL_PREFIX} )


then it reflects the correct directory, but the CMakeCache.txt file  
still shows /usr/local.  Am I misunderstanding something?


Thanks,

James

___
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