[CMake] cmake . -DCMAKE_INSTALL_PREFIX=/foo broken on solaris and hpux

Peter O'Gorman cmake at mlists.thewrittenword.com
Thu Sep 27 02:11:56 EDT 2007


(apoligies if this goes through twice - have had mailer issues)

Hi,

Having polluted /lib on a couple of machines I noticed that setting
CMAKE_INSTALL_PREFIX on the command line with -D does not work on
solaris or HP-UX. Using the solaris sparc download from cmake.org, I
can reproduce quite simply:

mkdir ctest; cd ctest
echo "Hello" > Hello.h
echo 'INSTALL_FILES(/include Hello.h)' > CMakeLists.txt
cmake . -DCMAKE_INSTALL_PREFIX=/tmp/install_test
gmake
gmake install

The problem is that although CMAKE_INSTALL_PREFIX is correctly set in
CMakeCache.txt in the install file, cmake_install.cmake, we have:
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  SET(CMAKE_INSTALL_PREFIX "")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)

This should, of course be:
# Set the install prefix
IF(NOT DEFINED CMAKE_INSTALL_PREFIX)
  SET(CMAKE_INSTALL_PREFIX "/tmp/install_test")
ENDIF(NOT DEFINED CMAKE_INSTALL_PREFIX)

The odd thing is that using ccmake to set the install prefix works
fine. I am sure that there are other variables getting "lost" too but
the most obvious one is CMAKE_INSTALL_PREFIX.

If we build cmake with gcc/g++ instead of the native Sun and HP
compilers then we get a cmake that behaves as expected.

Peter





More information about the CMake mailing list