0

I have this piece of CMake code:

if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) set ( CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" ) endif() message ( "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX} )

The first time I run cmake it correctly shows CMAKE_INSTALL_PREFIX pointing to my build_dir/install

The second time I run cmake, it gets back to /usr/local.

What's wrong ?

michal
  • 748
  • 1
  • 7
  • 15
  • So it seems using CACHE FORCE fiex issue for me. if ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) set ( CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE PATH "Install dir" FORCE) endif() message ( "CMAKE_INSTALL_PREFIX: " ${CMAKE_INSTALL_PREFIX} ) p.s. Sorry, don't know how to format code in comment – michal Oct 25 '18 at 16:00
  • 1
    Comments are not for multiline code. As the questions's author, you may add the code directly into the question post (by editing it). – Tsyvarev Oct 25 '18 at 16:38

0 Answers0