[CMake] CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT returns false when expected true

John Drescher drescherjm at gmail.com
Mon Dec 14 12:07:33 EST 2009


Under cmake-2.8.0 I have the following section in my CMakeLists.txt

IF(CMAKE_SIZEOF_VOID_P MATCHES 4)
string (REPLACE "\\" "/" PGM_FILES $ENV{PROGRAMFILES})
ELSE(CMAKE_SIZEOF_VOID_P MATCHES 4)
# On WIN64 use the 64 bit program files..
string (REPLACE "\\" "/" PGM_FILES $ENV{ProgramW6432})
ENDIF(CMAKE_SIZEOF_VOID_P MATCHES 4)

SET (DEFAULT_INSTALL_PATH ${PGM_FILES}/UPMC/${CMAKE_PROJECT_NAME}
CACHE STRING "Default Install Path")

if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   set (CMAKE_INSTALL_PREFIX ${DEFAULT_INSTALL_PATH} CACHE STRING
"Install path" FORCE)
   message("CMAKE_INSTALL_PREFIX Initialized to default setting to "
${DEFAULT_INSTALL_PATH})
else (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
   message("CMAKE_INSTALL_PREFIX not Initialized to default keeping "
${CMAKE_INSTALL_PREFIX})
endif (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)

ENDIF(WIN32)

The expected value for the QtBasicUtils project is if the user did not
change CMAKE_INSTALL_PREFIX the path should be
C:/Program Files (x86)/UPMC/QtBasicUtils

on 64 bit systems or

C:/Program Files/UPMC/QtBasicUtils

on 32 bit systems

However this is not getting set and I get the following message in my log:
CMAKE_INSTALL_PREFIX not Initialized to default keeping C:/Program
Files (x86)/QtBasicUtils

-- 
John M. Drescher


More information about the CMake mailing list