[CMake] Any way to append CMAKE_INSTALL_PREFIX with CMAKE_CFG_INTDIR?

David Cole DLRdave at aol.com
Tue Mar 24 14:22:47 EDT 2015


An "install" of a CMake based project is invoked something like this
from within a generated Visual Studio project:

    cmake.exe -DBUILD_TYPE=$(Configuration) -P cmake_install.cmake

If you dig into the (generated) cmake_install.cmake file, you'll see
a chunk like this right near the top of the file:

    if(NOT DEFINED CMAKE_INSTALL_PREFIX)
      set(CMAKE_INSTALL_PREFIX "C:/Program Files (x86)/Tutorial")
    endif()

One thing you could do is write your own custom install command that
passes in a value of CMAKE_INSTALL_PREFIX with the per-configuration
suffix you're looking for.

    cmake.exe -DBUILD_TYPE=${CMAKE_CFG_INTDIR}
-DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}${CMAKE_CFG_INTDIR} -P
cmake_install.cmake


HTH,
David C.


On Tue, Mar 24, 2015 at 1:32 PM, Thompson, KT <kgt at lanl.gov> wrote:
> Hi,
>
>
>
> For build tools like Visual Studio or Xcode, I would like to have
> CMAKE_INSTALL_PREFIX end with the build configuration type (Release, Debug,
> etc.)  I tried to append CMAKE_INSTALL_PREFIX with ${CMAKE_CFG_INTDIR} or
> $<CONFIG> but those approaches didn’t work (The install directory had was a
> folder that ended with the string literal ‘${configuration}’).  Can anyone
> provide a recipe that allows me to run cmake once to generate a project and
> then toggle between Debug and Release in the build tool to generate separate
> installations in directories that have names that use the configuration
> type?
>
>
>
> Thanks!
>
>
>
> -kt
>
> Kelly (KT) Thompson
>
>
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list