[CMake] set CMAKE_INSTALL_PREFIX in CMakeLists
Tyler Roscoe
tyler at cryptio.net
Tue Nov 30 12:48:52 EST 2010
On Thu, Nov 25, 2010 at 02:01:31PM +0100, Marcel Loose wrote:
> >>> On 24-11-2010 at 17:45, in message
> <20101124164507.GG23449 at cryptio.net>, Tyler
> Roscoe <tyler at 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:
[tylermr at tpb006:~/cmake-test-install-prefix]$ cmake --version
cmake version 2.8.3
[tylermr at 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}")
[tylermr at 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
More information about the CMake
mailing list