[CMake] is ccmake reliable?
John Drescher
drescherjm at gmail.com
Tue Sep 15 16:13:24 EDT 2009
> So assuming that I wanted my CMakeLists.txt file to modify the default
> install location, but allow the user to change this, wouldn't I do something
> like:
>>
>> set( CMAKE_INSTALL_PREFIX
>> ${CMAKE_CURRENT_BINARY_DIR}
>> CACHE PATH "installation path"
>> )
>
> This doesn't work - I assume that this is because CMAKE_INSTALL_PREFIX is a
> special (internally defined) variable? When I run ccmake and configure, the
> value remains as /usr/local.
Here is what I do in my cuurent project:
IF(WIN32)
#The following command changes \ to / in the Program Files Path so
CMake will not complain
#about bad escape sequences.
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 (CMAKE_INSTALL_PREFIX ${PGM_FILES}/UPMC/${CMAKE_PROJECT_NAME}
CACHE STRING "Default Install Path" FORCE)
configure_file (
"${PROJECT_SOURCE_DIR}/install.bat.in"
"${PROJECT_BINARY_DIR}/Batch/install.bat"
)
ENDIF(WIN32)
John
More information about the CMake
mailing list