Re: [CMake] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-12-02 Thread Marcel Loose
 On 30-11-2010 at 18:48, in message
20101130174852.gc10...@cryptio.net, Tyler
Roscoe ty...@cryptio.net wrote: 
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
  On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
  On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
  
 SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)
   
   So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
   and without the FORCE option.
 
  No, as I mentioned, there was an article of one the
 CMake-maintainers
  who recommended this.
  
  Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
  is processed, so the above will never do anything.
  
  tyler
 
 Well, I tested this before I posted my reply. It does work the way
I
 describe it. Try it yourself.
 
 It doesn't work for me:
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)
 
 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b 
cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to:
/tpb006/tylermr/cmake-test-install-prefix/b

Hi Tyler,

I now see why it works for me and not for you. Maybe I didn't write it
clearly, but I do SET(CMAKE_INSTALL_PREFIX ...) *before* the call to
PROJECT(). You are right that it doesn't work when you do it after the
PROJECT() call. Unfortunately, the solution with the IF-test doesn't
work when you use it before the PROJECT() call, for obvious reasons I
would say.

So, there are two solutions that work, but you have to choose carefully
among them.

1) Use this snippet *before* PROJECT(xxx):
  SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment)

2) Use this snippet *after* PROJECT(xxx):
  IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment FORCE)
  ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

Best regards,
Marcel Loose.

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-12-02 Thread Marcel Loose
 On 30-11-2010 at 21:36, in message
759ee5dc-038d-4c17-91da-98121049a...@mac.com, S Roderick
kiwi@mac.com
wrote: 
 On Nov 30, 2010, at 13:40 , David Cole wrote:
 
 It probably works accidentally if you do the set before the
project 
 command.
 
 That is what we do, and it definitely works for us. Set it _before_
the 
 PROJECT() statement.
 
+1 for me. I have a LofarInit.cmake file that is included before
PROJECT(LOFAR). I wouldn't want this feature to break.

Regards,
Marcel Loose.

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-12-02 Thread Michael Wild
On 12/02/2010 10:18 AM, Marcel Loose wrote:
 On 30-11-2010 at 18:48, in message
 20101130174852.gc10...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
 On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
 On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:

   SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)

 So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
 and without the FORCE option.

 No, as I mentioned, there was an article of one the
 CMake-maintainers
 who recommended this.

 Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
 is processed, so the above will never do anything.

 tyler

 Well, I tested this before I posted my reply. It does work the way
 I
 describe it. Try it yourself.

 It doesn't work for me:

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)

 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})

 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b 
 cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to:
 /tpb006/tylermr/cmake-test-install-prefix/b
 
 Hi Tyler,
 
 I now see why it works for me and not for you. Maybe I didn't write it
 clearly, but I do SET(CMAKE_INSTALL_PREFIX ...) *before* the call to
 PROJECT(). You are right that it doesn't work when you do it after the
 PROJECT() call. Unfortunately, the solution with the IF-test doesn't
 work when you use it before the PROJECT() call, for obvious reasons I
 would say.
 
 So, there are two solutions that work, but you have to choose carefully
 among them.
 
 1) Use this snippet *before* PROJECT(xxx):
   SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment)
 
 2) Use this snippet *after* PROJECT(xxx):
   IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment FORCE)
   ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 
 Best regards,
 Marcel Loose.

Considering what David said, the first solution depends on the
implementation details of the PROJECT command and is very fragile since
it works accidentally for some versions of CMake. I don't consider it
to be an option at all. I would suggest to always use the second option.

My 2c.

Michael

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-12-02 Thread S Roderick
On Dec 2, 2010, at 04:35 , Michael Wild wrote:

 On 12/02/2010 10:18 AM, Marcel Loose wrote:
 On 30-11-2010 at 18:48, in message
 20101130174852.gc10...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
 On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
 On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
 
  SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)
 
 So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
 and without the FORCE option.
 
 No, as I mentioned, there was an article of one the
 CMake-maintainers
 who recommended this.
 
 Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
 is processed, so the above will never do anything.
 
 tyler
 
 Well, I tested this before I posted my reply. It does work the way
 I
 describe it. Try it yourself.
 
 It doesn't work for me:
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)
 
 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b 
 cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to:
 /tpb006/tylermr/cmake-test-install-prefix/b
 
 Hi Tyler,
 
 I now see why it works for me and not for you. Maybe I didn't write it
 clearly, but I do SET(CMAKE_INSTALL_PREFIX ...) *before* the call to
 PROJECT(). You are right that it doesn't work when you do it after the
 PROJECT() call. Unfortunately, the solution with the IF-test doesn't
 work when you use it before the PROJECT() call, for obvious reasons I
 would say.
 
 So, there are two solutions that work, but you have to choose carefully
 among them.
 
 1) Use this snippet *before* PROJECT(xxx):
  SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment)
 
 2) Use this snippet *after* PROJECT(xxx):
  IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX path CACHE PATH comment FORCE)
  ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 
 Best regards,
 Marcel Loose.
 
 Considering what David said, the first solution depends on the
 implementation details of the PROJECT command and is very fragile since
 it works accidentally for some versions of CMake. I don't consider it
 to be an option at all. I would suggest to always use the second option.

As long as one of these approaches works, I'm happy. Just choose one, and 
document it.
S

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-30 Thread Tyler Roscoe
On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
  On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote: 
  On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
  
 SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)
   
   So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
   and without the FORCE option.
 
  No, as I mentioned, there was an article of one the
 CMake-maintainers
  who recommended this.
  
  Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
  is processed, so the above will never do anything.
  
  tyler
 
 Well, I tested this before I posted my reply. It does work the way I
 describe it. Try it yourself.

It doesn't work for me:

[tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
cmake version 2.8.3

[tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
cmake_minimum_required(VERSION 2.8)
project(p)

set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})

[tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b  cmake ..
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
CMAKE_INSTALL_PREFIX = /usr/local
-- Configuring done
-- Generating done
-- Build files have been written to: /tpb006/tylermr/cmake-test-install-prefix/b
___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-30 Thread David Cole
It probably works accidentally if you do the set before the project command.

Unfortunately, the project command has significant side effects.
Setting a default (cached) value for CMAKE_INSTALL_PREFIX might be one
of those...


On Tuesday, November 30, 2010, Tyler Roscoe ty...@cryptio.net wrote:
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
  On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote:
  On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
 
     SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)
  
   So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
   and without the FORCE option.
 
  No, as I mentioned, there was an article of one the
 CMake-maintainers
  who recommended this.
 
  Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
  is processed, so the above will never do anything.
 
  tyler

 Well, I tested this before I posted my reply. It does work the way I
 describe it. Try it yourself.

 It doesn't work for me:

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)

 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})

 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b  cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to: 
 /tpb006/tylermr/cmake-test-install-prefix/b
 ___
 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


Re: [CMake] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-30 Thread David Cole
If we want this unintentional behavior to continue working as is into
the future, we should add a test for this behavior and make the test
fail if the value of CMAKE_INSTALL_PREFIX is not as expected at the
bottom of CMakeLists...

Anybody want to add some code to the test suite to validate this
particular idiosyncrasy?


On Tuesday, November 30, 2010, S Roderick kiwi@mac.com wrote:
 On Nov 30, 2010, at 13:40 , David Cole wrote:

 It probably works accidentally if you do the set before the project 
 command.

 That is what we do, and it definitely works for us. Set it _before_ the 
 PROJECT() statement.


 Unfortunately, the project command has significant side effects.
 Setting a default (cached) value for CMAKE_INSTALL_PREFIX might be one
 of those...


 On Tuesday, November 30, 2010, Tyler Roscoe ty...@cryptio.net wrote:
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
 On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote:
 On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:

   SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)

 So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
 and without the FORCE option.

 No, as I mentioned, there was an article of one the
 CMake-maintainers
 who recommended this.

 Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
 is processed, so the above will never do anything.

 tyler

 Well, I tested this before I posted my reply. It does work the way I
 describe it. Try it yourself.

 It doesn't work for me:

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3

 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)

 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})

 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b  cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to: 
 /tpb006/tylermr/cmake-test-install-prefix/b


___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-30 Thread Stephen Roderick
On Nov 30, 2010, at 16:03 , David Cole wrote:

 If we want this unintentional behavior to continue working as is into
 the future, we should add a test for this behavior and make the test
 fail if the value of CMAKE_INSTALL_PREFIX is not as expected at the
 bottom of CMakeLists...

I think it is a useful behavior to have. We use it within an enterprise 
environment to set a reasonable default, if the user hasn't specifically 
overridden it.  As one other commentor stated though, as a project developer 
(not CMake) you need to make this very obvious in case the user tries to figure 
out why something was installed somewhere (without the user telling it 
anything)!
S
___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-30 Thread S Roderick
On Nov 30, 2010, at 13:40 , David Cole wrote:

 It probably works accidentally if you do the set before the project command.

That is what we do, and it definitely works for us. Set it _before_ the 
PROJECT() statement.

 
 Unfortunately, the project command has significant side effects.
 Setting a default (cached) value for CMAKE_INSTALL_PREFIX might be one
 of those...
 
 
 On Tuesday, November 30, 2010, Tyler Roscoe ty...@cryptio.net wrote:
 On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
 On 24-11-2010 at 17:45, in message
 20101124164507.gg23...@cryptio.net, Tyler
 Roscoe ty...@cryptio.net wrote:
 On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
 
   SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
 prefix)
 
 So, without the test to
 CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
 and without the FORCE option.
 
 No, as I mentioned, there was an article of one the
 CMake-maintainers
 who recommended this.
 
 Micha is correct. CMAKE_INSTALL_PREFIX is set before your
 CMakeLists.txt
 is processed, so the above will never do anything.
 
 tyler
 
 Well, I tested this before I posted my reply. It does work the way I
 describe it. Try it yourself.
 
 It doesn't work for me:
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cmake --version
 cmake version 2.8.3
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ cat CMakeLists.txt
 cmake_minimum_required(VERSION 2.8)
 project(p)
 
 set (CMAKE_INSTALL_PREFIX foo CACHE PATH docstring)
 message (CMAKE_INSTALL_PREFIX = ${CMAKE_INSTALL_PREFIX})
 
 [tyle...@tpb006:~/cmake-test-install-prefix]$ mkdir b  cd b  cmake ..
 -- The C compiler identification is GNU
 -- The CXX compiler identification is GNU
 -- Check for working C compiler: /usr/bin/gcc
 -- Check for working C compiler: /usr/bin/gcc -- works
 -- Detecting C compiler ABI info
 -- Detecting C compiler ABI info - done
 -- Check for working CXX compiler: /usr/bin/c++
 -- Check for working CXX compiler: /usr/bin/c++ -- works
 -- Detecting CXX compiler ABI info
 -- Detecting CXX compiler ABI info - done
 CMAKE_INSTALL_PREFIX = /usr/local
 -- Configuring done
 -- Generating done
 -- Build files have been written to: 
 /tpb006/tylermr/cmake-test-install-prefix/b

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-26 Thread Diablo 666

 And *NEVER EVER* set CMAKE_INSTALL_PREFIX in your CMakeLists.txt file.
 That is a user-setting and you will make people angry at you if you
 override their choice in your code.

There is actually one single use-case where it might be useful to change this 
variable once:
Say you have a library libFoo installed in /path/to/libfoo. Now you like to 
have an add-on library.
You might want to normally install this library to the same location where the 
base library is.
The CMake file here can set the CMAKE_INSTALL_PREFIX to /path/to/libfoo _once_.


(I actually hope that there will never be a real libFoo in the world... I like 
to use the name in my mails)
  ___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-25 Thread Marcel Loose
 On 24-11-2010 at 17:45, in message
20101124164507.gg23...@cryptio.net, Tyler
Roscoe ty...@cryptio.net wrote: 
 On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
 
SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install
prefix)
  
  So, without the test to
CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
  and without the FORCE option.

 No, as I mentioned, there was an article of one the
CMake-maintainers
 who recommended this.
 
 Micha is correct. CMAKE_INSTALL_PREFIX is set before your
CMakeLists.txt
 is processed, so the above will never do anything.
 
 tyler

Well, I tested this before I posted my reply. It does work the way I
describe it. Try it yourself.

Marcel.

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-24 Thread Marcel Loose
 On 23-11-2010 at 15:37, in message
1290523061.2001.8.ca...@gildemeister-2,
Micha Renner micha.ren...@t-online.de wrote: 
 Am Dienstag, den 23.11.2010, 15:01 +0100 schrieb Michael Wild:
 On 11/23/2010 02:33 PM, Micha Renner wrote:
  Am Dienstag, den 23.11.2010, 14:01 +0100 schrieb
tomas...@sbc.su.se:
  Dear Cmake users,
 
  1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file
with
  SET(CMAKE_INSTALL_PREFIX, my/path)
   ^
   No comma!
  
  greetings
  Micha
 
 And *NEVER EVER* set CMAKE_INSTALL_PREFIX in your CMakeLists.txt
file.
 That is a user-setting and you will make people angry at you if you
 override their choice in your code.
 
 Okay, then this might help:
 
 IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   SET(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH Foo install
prefix FORCE)
 ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
 
 Of course, this is not my idea. It had someone from kitware, I don't
 remember who it was.
 
 
 greetings
 Micha

Hi Micha,

I would prefer to use

  SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install prefix)

So, without the test to CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
and without the FORCE option.

Reason: if someone unsets CMAKE_INSTALL_PREFIX on the command-line with
-U, CMAKE_INSTALL_PREFIX will default to /foo/bar (which is the
project's default), instead of /usr/local (which is CMake's default).

Just my 2cts.

Marcel Loose.
___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-24 Thread Tyler Roscoe
On Wed, Nov 24, 2010 at 12:11:56PM +0100, Micha Renner wrote:
 
SET(CMAKE_INSTALL_PREFIX /foo/bar CACHE PATH Foo install prefix)
  
  So, without the test to CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT,
  and without the FORCE option.

 No, as I mentioned, there was an article of one the CMake-maintainers
 who recommended this.

Micha is correct. CMAKE_INSTALL_PREFIX is set before your CMakeLists.txt
is processed, so the above will never do anything.

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


[CMake] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-23 Thread tomasoni
Dear Cmake users,

1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
SET(CMAKE_INSTALL_PREFIX, my/path)
but the variable remain unset; everything works fine if the variable is
set on the command line when invoking cmake
(-DCMAKE_INSTALL_PREFIX=my/path).

2) I am also looking for a way to avoid having to invoke cmake -GEclipse
CDT4 - Unix Makefiles option. Can I set it in the CMakeLists?

Trying to avoid my users some typing...

Thank you as usual,
Mattia
___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-23 Thread Micha Renner
Am Dienstag, den 23.11.2010, 14:01 +0100 schrieb tomas...@sbc.su.se:
 Dear Cmake users,
 
 1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
 SET(CMAKE_INSTALL_PREFIX, my/path)
 ^
 No comma!

greetings
Micha


___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-23 Thread Michael Wild
On 11/23/2010 02:33 PM, Micha Renner wrote:
 Am Dienstag, den 23.11.2010, 14:01 +0100 schrieb tomas...@sbc.su.se:
 Dear Cmake users,

 1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
 SET(CMAKE_INSTALL_PREFIX, my/path)
  ^
  No comma!
 
 greetings
 Micha

And *NEVER EVER* set CMAKE_INSTALL_PREFIX in your CMakeLists.txt file.
That is a user-setting and you will make people angry at you if you
override their choice in your code.

Michael

___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-23 Thread Micha Renner
Am Dienstag, den 23.11.2010, 15:01 +0100 schrieb Michael Wild:
 On 11/23/2010 02:33 PM, Micha Renner wrote:
  Am Dienstag, den 23.11.2010, 14:01 +0100 schrieb tomas...@sbc.su.se:
  Dear Cmake users,
 
  1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
  SET(CMAKE_INSTALL_PREFIX, my/path)
   ^
   No comma!
  
  greetings
  Micha
 
 And *NEVER EVER* set CMAKE_INSTALL_PREFIX in your CMakeLists.txt file.
 That is a user-setting and you will make people angry at you if you
 override their choice in your code.

Okay, then this might help:

IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX /usr/local CACHE PATH Foo install
 prefix FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

Of course, this is not my idea. It had someone from kitware, I don't
remember who it was.


greetings
Micha



___
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] set CMAKE_INSTALL_PREFIX in CMakeLists

2010-11-23 Thread Alexander Neundorf
On Tuesday 23 November 2010, tomas...@sbc.su.se wrote:
 Dear Cmake users,

 1) I am trying to set CMAKE_INSTALL_PREFIX in the CMakeLists file with
 SET(CMAKE_INSTALL_PREFIX, my/path)
 but the variable remain unset; everything works fine if the variable is
 set on the command line when invoking cmake
 (-DCMAKE_INSTALL_PREFIX=my/path).

 2) I am also looking for a way to avoid having to invoke cmake -GEclipse
 CDT4 - Unix Makefiles option. Can I set it in the CMakeLists?

If you use cmake-gui (instead of cmake, which may be a good idea if the users 
don't like typing that much), they are asked to select this from a combobox, 
and on later runs their previous choice is the default selection there.

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