Strangely, running "cmake -DCMAKE_INSTALL_PREFIX=/some/path" does NOT
rewrite the cmake_install.cmake, but does rewrite the CMakeCache.txt and
other files.  The result is a bad install path won't go away until one
manually removes the cmake_install.cmake file(s).

On Thu, Dec 4, 2014 at 9:48 PM, J Decker <d3c...@gmail.com> wrote:

> I find it's better to define CMAKE_INSTALL_PREFIX on the command line when
> building
>
> I do have this bit of code...
>
> IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>   SET(CMAKE_INSTALL_PREFIX
>     ${CMAKE_BINARY_DIR}/../${CMAKE_BUILD_TYPE}_out CACHE PATH "Install
> default 'out' in this directory." FORCE
>     )
> ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
>
>
> which keeps it from overwriting an already set value (from the command
> line); and make sure it's in the cache so cmake-gui can edit it...
>
> (if  project() does something with cmake_isnstall_prefix might also be a
> bug)
>
> On Thu, Dec 4, 2014 at 7:27 PM, Chris Johnson <cxjohn...@gmail.com> wrote:
>
>> I have a global include file used by all of the CMakeLists.txt files in
>> my project. In it, I set the value of CMAKE_INSTALL_PREFIX, as well as a
>> number of other variables and functions.
>>
>> In my CMakeLists.txt file, I had this:
>>
>> cmake_minimum_require(VERSION 2.8.4)
>> include(global.inc)
>> project(whatever)
>>
>> When I run cmake, the value of CMAKE_INSTALL_PREFIX is lost! Instead, in
>> the resulting cmake_install.cmake file has been defaulted back to
>> /usr/local which is completely wrong.
>>
>> However, if I change the order to this:
>>
>> cmake_minimum_require(VERSION 2.8.4)
>> project(whatever)
>> include(global.inc)
>>
>> It appears to work.
>>
>> I find nothing in the documentation saying that the project() directive
>> will set CMAKE_INSTALL_PREFIX.
>>
>> Even more strangely, if I run cmake a second time with the first
>> configuration (include before project), it will rewrite cmake_install.cmake
>> with the correct value.
>> ​ ​
>> That is, the behavior of cmake appears to be different based on whether
>> the build directory is empty or already contains cmake_install.cmake and
>> CMakeCache.txt files
>> ​, even though they contain the wrong path value for
>> CMAKE_INSTALL_PREFIX.​
>>
>> What is going on here?
>>
>>
>>
>>
>>
>>
>> --
>>
>> 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

Reply via email to