[CMake] using "INSTALL(CODE ..." for multiple configurations.

Michael Hertling mhertling at online.de
Sun May 29 21:55:27 EDT 2011


On 05/30/2011 02:58 AM, Campbell Barton wrote:
> Checking if this is possible since its quite verbose to have the same
> command 4 times, one for each configuration.
> 
> For blender3d on windows we need to extract python into the install
> dir since we bundle it.
> 
> This command looks like this:
> --- snip
> 
> install(
> 	CODE
> 	"
> 	execute_process(COMMAND \"${CMAKE_COMMAND}\" -E chdir
> \"${TARGETDIR_VER}/python/lib\"
> 		\"${CMAKE_COMMAND}\" -E tar xzfv \"${LIBDIR}/release/python32.tar.gz\")
> 	"
> 	CONFIGURATIONS Release
> )
> 
> --- snip
> 
> The annoyance is that the same command needs to be called 3 times,
> Release/RelWithDebInfo/MinSizeRel
> Is there some way to list multiple 'CONFIGURATIONS' ?

CMake's documentation states about INSTALL()'s CONFIGURATIONS
argument: "The CONFIGURATIONS argument specifies a *list* of
build configurations for which the install rule applies
(Debug, Release, etc.)."

> Ideally in this case Id like to have any 'Debug' extract
> python32_d.tar.gz and any other configuration extract python32.tar.gz,
> but a ways to have multiple configurations do one command would at
> least be less verbose.

Are you sure that the CONFIGURATIONS clause is available for the
INSTALL(CODE ...) command? It's not specified, and on *nix, the
following CMakeLists.txt issues the message upon "make install"
regardless of the CMAKE_BUILD_TYPE variable's value whereas the
INSTALL(FILES ...) command is sensitive as expected:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
PROJECT(INSTCONF NONE)
SET(CMAKE_VERBOSE_MAKEFILE ON)
INSTALL(CODE "MESSAGE(\"Installing\")" CONFIGURATIONS Release)
INSTALL(FILES ${CMAKE_SOURCE_DIR}/CMakeLists.txt
        DESTINATION ${CMAKE_BINARY_DIR}/cmake
        CONFIGURATIONS Release)

Does it work differently on Windows?

Regards,

Michael


More information about the CMake mailing list