Install destination problem

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Install destination problem

Chris Johnson
In all of my CMakeLists.txt files, I include a settings file, like so:

include(global_settings.cmake)

Inside global_settings.cmake, I have a line like this:

set( CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install )

When I run "make install" on my development system, the files are correctly installed where I expect to find them, in a subdirectory of my build directory named "install".

But when I tried to do the same on our production server just now, it tried to install the binaries into /usr/local/bin.

It's as if $CMAKE_INSTALL_PREFIX did not get set.

What am I doing wrong?

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install destination problem

Kris Thielemans-2

Hi

 

My guess is that you have a local variable CMAKE_INSTALL_PREFIX being shadowed by the global variable. Best to add the CACHE keyword etc in your set statement, then there’ll be only 1 variable.

 

Kris

 

From: CMake [mailto:[hidden email]] On Behalf Of Chris Johnson
Sent: 27 December 2016 23:27
To: [hidden email]
Subject: [CMake] Install destination problem

 

In all of my CMakeLists.txt files, I include a settings file, like so:

 

include(global_settings.cmake)

 

Inside global_settings.cmake, I have a line like this:

 

set( CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install )

 

When I run "make install" on my development system, the files are correctly installed where I expect to find them, in a subdirectory of my build directory named "install".

 

But when I tried to do the same on our production server just now, it tried to install the binaries into /usr/local/bin.

 

It's as if $CMAKE_INSTALL_PREFIX did not get set.

 

What am I doing wrong?


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install destination problem

Chris Johnson
I've found experimentally that if the install directory exists, it works correctly.  If it does not exist, the prefix somehow gets changed to /usr/local.  I've not found where that's getting set yet.

Thanks for the recommendation on CACHE.

On Wed, Dec 28, 2016 at 9:46 AM, Kris Thielemans <[hidden email]> wrote:

Hi

 

My guess is that you have a local variable CMAKE_INSTALL_PREFIX being shadowed by the global variable. Best to add the CACHE keyword etc in your set statement, then there’ll be only 1 variable.

 

Kris

 

From: CMake [mailto:[hidden email]] On Behalf Of Chris Johnson
Sent: 27 December 2016 23:27
To: [hidden email]
Subject: [CMake] Install destination problem

 

In all of my CMakeLists.txt files, I include a settings file, like so:

 

include(global_settings.cmake)

 

Inside global_settings.cmake, I have a line like this:

 

set( CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install )

 

When I run "make install" on my development system, the files are correctly installed where I expect to find them, in a subdirectory of my build directory named "install".

 

But when I tried to do the same on our production server just now, it tried to install the binaries into /usr/local/bin.

 

It's as if $CMAKE_INSTALL_PREFIX did not get set.

 

What am I doing wrong?



--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Install destination problem

Michael Ellery
This might be helpful:

http://stackoverflow.com/questions/39481958/setting-cmake-install-prefix-from-cmakelists-txt-file/39485990#39485990

Also, FWIW, the generated makefile (if you are using the makefile generator) supports DESTDIR which will get prepended to the CMAKE_INSTALL_PREFIX path (which sounds like it is not useful in your case).

-Mike

> On Dec 28, 2016, at 8:52 AM, Chris Johnson <[hidden email]> wrote:
>
> I've found experimentally that if the install directory exists, it works correctly.  If it does not exist, the prefix somehow gets changed to /usr/local.  I've not found where that's getting set yet.
>
> Thanks for the recommendation on CACHE.
>
> On Wed, Dec 28, 2016 at 9:46 AM, Kris Thielemans <[hidden email]> wrote:
> Hi
>
>  
>
> My guess is that you have a local variable CMAKE_INSTALL_PREFIX being shadowed by the global variable. Best to add the CACHE keyword etc in your set statement, then there’ll be only 1 variable.
>
>  
>
> Kris
>
>  
>
> From: CMake [mailto:[hidden email]] On Behalf Of Chris Johnson
> Sent: 27 December 2016 23:27
> To: [hidden email]
> Subject: [CMake] Install destination problem
>
>  
>
> In all of my CMakeLists.txt files, I include a settings file, like so:
>
>  
>
> include(global_settings.cmake)
>
>  
>
> Inside global_settings.cmake, I have a line like this:
>
>  
>
> set( CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install )
>
>  
>
> When I run "make install" on my development system, the files are correctly installed where I expect to find them, in a subdirectory of my build directory named "install".
>
>  
>
> But when I tried to do the same on our production server just now, it tried to install the binaries into /usr/local/bin.
>
>  
>
> It's as if $CMAKE_INSTALL_PREFIX did not get set.
>
>  
>
> What am I doing wrong?
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...