[CMake] Setting install dir based on Debug or Release

Scott Aron Bloom scott at towel42.com
Tue May 19 13:42:44 EDT 2015


We use the install system, and love it.

However, since our install include copies of 3rd party debug libraries that are named the same as the release counterparts (not our call ;() I would like to just have a the path be install.deb rather than "install"
We set the CMAKE_INSTLL_PREFIX variable, but all the configurations get set to the same install...

The problem I see, is the code only gets executed once, and at that point the CMAKE_BUILD_TYPE isn't set yet..  Yes I realize this for windows, so it is a multi-config system.. but I cant believe Im the only one with this issue.

This is is what Im trying...

IF( "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo")
        SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install)
        message( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
    ELSEIF( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
        SET(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/Install.deb)
        message( STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}" )
    ELSE()
        MESSAGE( STATUS "CMAKE_BUILD_TYPE not set yet ${CMAKE_BUILD_TYPE}" )
    ENDIF()


Any help would be most appreciated
Thanks

Scott
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20150519/47f708ed/attachment.html>


More information about the CMake mailing list