View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0012438CMakeCMakepublic2011-09-01 04:202012-09-03 16:00
Reporterchrislu 
Assigned ToBrad King 
PriorityimmediateSeverityblockReproducibilityalways
StatusclosedResolutionduplicate 
PlatformPCOSWindowsOS Version7 x64 SP1
Product VersionCMake 2.8.5 
Target VersionFixed in Version 
Summary0012438: add_command _needs_ CONFIGURATION parameter for multi-target environments
DescriptionWhy do i need to jump too such hoops to do a simple thing as to add different post build commands to release and debug builds... and then it does not even do what i want.

This just wants to add dll files for release and debug builds to the respective directories:


get_directory_property(link_dirs LINK_DIRECTORIES)
list(REMOVE_ITEM in_libraries debug optimized general)
list(REMOVE_ITEM link_dirs ${SCHISM_LIBRARY_DIR})
set(conf_list release debug)

foreach(conf ${conf_list})
    foreach(link_lib ${in_libraries})
        set(link_lib_dll ${link_lib}.dll)
        foreach(ldir ${link_dirs})
            set(dll_path ${ldir}/${conf}/${link_lib_dll})
            if (EXISTS ${dll_path})
                # make if fail for the wrong configuration
                string(REPLACE /${conf}/ "/$<CONFIGURATION>/" dll_path ${dll_path})
                add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
                                   COMMAND if EXIST ${dll_path} ${CMAKE_COMMAND} -E echo "copying ${link_lib_dll} to ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>/"
                                   COMMAND if EXIST ${dll_path} ${CMAKE_COMMAND} -E copy_if_different ${dll_path} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIGURATION>/)
            endif (EXISTS ${dll_path})
        endforeach(ldir)
    endforeach(link_lib)
endforeach(conf)

TagsNo tags attached.
Attached Files

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

  Notes
(0028885)
Brad King (manager)
2012-03-09 14:49

Resolving as duplicate of 0009974 which requests a sample use case not covered by generator expressions before further progress can be made. Please post there if you have one.

I suggest going to the mailing list for further help without this feature.
(0030833)
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
2011-09-01 04:20 chrislu New Issue
2012-03-09 14:42 Brad King Relationship added related to 0009974
2012-03-09 14:44 Brad King Relationship replaced duplicate of 0009974
2012-03-09 14:49 Brad King Note Added: 0028885
2012-03-09 14:49 Brad King Status new => resolved
2012-03-09 14:49 Brad King Resolution open => duplicate
2012-03-09 14:49 Brad King Assigned To => Brad King
2012-09-03 16:00 David Cole Note Added: 0030833
2012-09-03 16:00 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team