[cmake-developers] [CMake 0012438]: add_command _needs_ CONFIGURATION parameter for multi-target environments
Mantis Bug Tracker
mantis at public.kitware.com
Thu Sep 1 04:20:45 EDT 2011
The following issue has been SUBMITTED.
======================================================================
http://public.kitware.com/Bug/view.php?id=12438
======================================================================
Reported By: chrislu
Assigned To:
======================================================================
Project: CMake
Issue ID: 12438
Category: CMake
Reproducibility: always
Severity: block
Priority: immediate
Status: new
======================================================================
Date Submitted: 2011-09-01 04:20 EDT
Last Modified: 2011-09-01 04:20 EDT
======================================================================
Summary: add_command _needs_ CONFIGURATION parameter for
multi-target environments
Description:
Why 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)
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2011-09-01 04:20 chrislu New Issue
======================================================================
More information about the cmake-developers
mailing list