MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0012302 | CMake | CMake | public | 2011-06-24 10:46 | 2012-01-02 15:56 | |||||
Reporter | Adam Clements | |||||||||
Assigned To | David Cole | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||
Status | closed | Resolution | duplicate | |||||||
Platform | VS10 | OS | Windows | OS Version | 7 | |||||
Product Version | CMake 2.8.4 | |||||||||
Target Version | CMake 2.8.5 | Fixed in Version | CMake 2.8.5 | |||||||
Summary | 0012302: Unable to use CMAKE_CFG_INTDIR in the OUTPUT of a CUSTOM_COMMAND | |||||||||
Description | I have a custom command step in my build process that copies non-source resources (xml schemas) from my source to my build tree if they have been updated. For this I have a custom command which OUTPUTs the file in the binary directory and DEPENDs on the file in the source tree. The COMMAND then copies from the source to the binary tree and COMMENTs which file has changed and is being updated (so that I can keep track in my build status). This works fine until I try and make it copy into the configuration specific build directories. I initially tried using $(ConfigurationName) in the path, then found ${CMAKE_CFG_INTDIR}, but while that copies the right files to the right places, it doesn't seem to keep track of the OUTPUT file, and so the copy step happens every time (as opposed to before when it only activated when the file had changed). If I don't specify the directory using ${CMAKE_CFG_INTDIR} then the file is output to the base of the binary tree, rather than in the configuration as I originally expected. | |||||||||
Steps To Reproduce | # Here's a simplified version of my build script (pulling some things out of macros # for clarity) #... Add_Executable(MainExecutable ${SOURCES}) #... # Working example - only copies when the file is changed, but is # configuration specific Set ( DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/Debug/foo.xsd ) Add_Custom_Command( OUTPUT ${DESTINATION} COMMAND ${CMAKE_COMMAND} -E copy_if_different foo.xsd ${DESTINATION} DEPENDS foo.xsd COMMENT "Updating foo.xsd ..." ) Set (POST_BUILD_OUTPUT_DEPS ${POST_BUILD_OUTPUT_DEPS} ${DESTINATION}) # What I tried originally, expecting ${CMAKE_CURRENT_BINARY_DIR} to # include the Release/Debug part of the path to the executable Set ( DESTINATION foo.xsd ) Add_Custom_Command( OUTPUT ${DESTINATION} COMMAND ${CMAKE_COMMAND} -E copy_if_different foo.xsd ${DESTINATION} DEPENDS foo.xsd COMMENT "Updating foo.xsd ..." ) Set (POST_BUILD_OUTPUT_DEPS ${POST_BUILD_OUTPUT_DEPS} ${DESTINATION}) # Desired code, but copies the file every time regardless of changes Set ( DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/foo.xsd ) Add_Custom_Command( OUTPUT ${DESTINATION} COMMAND ${CMAKE_COMMAND} -E copy_if_different foo.xsd ${DESTINATION} DEPENDS foo.xsd COMMENT "Updating foo.xsd ..." ) Set (POST_BUILD_OUTPUT_DEPS ${POST_BUILD_OUTPUT_DEPS} ${DESTINATION}) #... Add_Custom_Target(SYNC_UNCOMPILED ALL DEPENDS ${POST_BUILD_OUTPUT_DEPS}) Add_Dependencies(MainExecutable SYNC_UNCOMPILED) | |||||||||
Additional Information | ||||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | Cmake_Custom_output_testcase.zip (1,654) 2011-06-24 12:59 https://public.kitware.com/Bug/file/3959/Cmake_Custom_output_testcase.zip | |||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2011-06-24 10:46 | Adam Clements | New Issue | ||||||||
2011-06-24 11:37 | Clinton Stimpson | Note Added: 0026962 | ||||||||
2011-06-24 12:00 | Adam Clements | Note Added: 0026963 | ||||||||
2011-06-24 12:15 | Adam Clements | Note Added: 0026964 | ||||||||
2011-06-24 12:59 | Adam Clements | File Added: Cmake_Custom_output_testcase.zip | ||||||||
2011-06-24 13:01 | Adam Clements | Note Added: 0026966 | ||||||||
2011-06-24 13:15 | Adam Clements | Note Deleted: 0026963 | ||||||||
2011-06-24 13:18 | Adam Clements | Note Edited: 0026966 | bug_revision_view_page.php?bugnote_id=26966#r372 | |||||||
2011-08-17 12:42 | David Cole | Note Added: 0027223 | ||||||||
2011-08-19 05:26 | Adam Clements | Note Added: 0027245 | ||||||||
2011-08-19 11:40 | David Cole | Assigned To | => David Cole | |||||||
2011-08-19 11:40 | David Cole | Status | new => assigned | |||||||
2011-08-19 11:40 | David Cole | Target Version | => CMake 2.8.6 | |||||||
2011-08-19 11:53 | David Cole | Note Added: 0027247 | ||||||||
2011-08-19 14:38 | David Cole | Target Version | CMake 2.8.6 => CMake 2.8.5 | |||||||
2011-08-19 14:43 | David Cole | Note Added: 0027249 | ||||||||
2011-08-19 14:43 | David Cole | Relationship added | duplicate of 0011927 | |||||||
2011-08-19 14:43 | David Cole | Status | assigned => resolved | |||||||
2011-08-19 14:43 | David Cole | Fixed in Version | => CMake 2.8.5 | |||||||
2011-08-19 14:43 | David Cole | Resolution | open => duplicate | |||||||
2011-08-19 14:44 | David Cole | Summary | Unable to use CMAKE_CFG_OUTDIR in the OUTPUT of a CUSTOM_COMMAND => Unable to use CMAKE_CFG_INTDIR in the OUTPUT of a CUSTOM_COMMAND | |||||||
2012-01-02 15:56 | David Cole | Note Added: 0028131 | ||||||||
2012-01-02 15:56 | David Cole | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|