View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006242CMakeCMakepublic2008-01-14 17:522012-09-03 16:00
ReporterLuke K 
Assigned ToBrad King 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionduplicate 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version 
Summary0006242: ADD_CUSTOM_COMMAND needs CONFIGURATIONS keyword for Visual Studio post-builds
DescriptionHi,

Our whole software team has just recently decided to move to CMake for our unified build system. We are encountering an annoying problem in Visual Studio 7.1 .NET 2003 where we want to have a different post-build command run depending on the project configuration, specifically to copy our newly built executable from the build area to the runtime location. We would like to have a separate runtime location for Debug and Release configurations, since each have different runtime dependencies (notably Debug configuration uses DLLs with 'd' suffix, among other files), and the executable name should also be different for Debug and Release (Debug executable has 'd' indicator).

Here is basically the CMake command we are using now:

        Add_Custom_Command(TARGET "${PROJECT}"
                           POST_BUILD
                           COMMAND "${command}" ARGS ${argumentList})

It would be AWESOME if we could use a command like this:

        Add_Custom_Command(TARGET "${PROJECT}"
                           POST_BUILD
                           CONFIGURATIONS ${configuration}
                           COMMAND "${command}" ARGS ${argumentList})

which would be similar to the Install command.

This is not a problem for our NMake or Codeblocks/Unix-based makefiles, because those makefiles are target-based, not based on project configuration.

Your help and contributions are greatly appreciated :-D

Luke
Additional InformationWe appreciate all the hard work you have contributed to keep CMake updated and the users of CMake satisfied. Keep up the good work!

Luke
Columbus, Ohio
Go bucks!
TagsNo tags attached.
Attached Files

 Relationships
duplicate of 0009974closedBrad King CMake should support custom commands that can vary by configuration. 

  Notes
(0019020)
Brad King (manager)
2010-01-04 10:28

Currently add_custom_command is one of the remaining places where we do not support per-configuration rules. This has been on my back burner for years but I do not know when I'll have time to finally do it.

It is possible to work around the limitation in some cases like this:

  add_custom_command(OUTPUT ... DEPENDS ...
    COMMAND ${CMAKE_COMMAND} -Dconfig=${CMAKE_CFG_INTDIR} -P myscript.cmake
    )

where myscript.cmake inspects the value of "config" to determine the configuration being built.

FYI, you can solve the original problem using the RUNTIME_OUTPUT_DIRECTORY target property. This will cause the build system to link the executable directly in the destination directory.
(0028883)
Brad King (manager)
2012-03-09 14:41

Resolving as duplicate of 0009974. Even though that one came later more discussion and updates have occurred there.
(0030832)
David Cole (manager)
2012-09-03 16:00

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2008-01-14 17:52 Luke K New Issue
2008-01-14 19:21 Alex Neundorf Category CCMake => CMake
2008-01-14 21:19 Bill Hoffman Status new => assigned
2008-01-14 21:19 Bill Hoffman Assigned To => David Cole
2009-12-28 15:38 David Cole Assigned To David Cole => Brad King
2010-01-04 10:28 Brad King Note Added: 0019020
2012-03-09 14:41 Brad King Note Added: 0028883
2012-03-09 14:41 Brad King Relationship added duplicate of 0009974
2012-03-09 14:41 Brad King Status assigned => resolved
2012-03-09 14:41 Brad King Resolution open => duplicate
2012-09-03 16:00 David Cole Note Added: 0030832
2012-09-03 16:00 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team