> 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
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to