MantisBT - CMake | |||||
View Issue Details | |||||
ID | Project | Category | View Status | Date Submitted | Last Update |
0015844 | CMake | CMake | public | 2015-11-11 15:04 | 2016-05-02 08:30 |
Reporter | Роман Донченко | ||||
Assigned To | |||||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | no change required | ||
Platform | OS | OS Version | |||
Product Version | CMake 3.3.2 | ||||
Target Version | Fixed in Version | ||||
Summary | 0015844: Custom command executing for file the target doesn't depend on | ||||
Description | If two targets have the same sources, it's possible for one of them to execute a custom command for a file that it doesn't depend on. | ||||
Steps To Reproduce | Create foo1.txt and foo2.txt with any contents and the following CMakeLists.txt: cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) set(S "${CMAKE_CURRENT_SOURCE_DIR}") set(B "${CMAKE_CURRENT_BINARY_DIR}") add_custom_command(OUTPUT bar1.txt COMMAND "${CMAKE_COMMAND}" -E md5sum "${S}/foo1.txt" "${S}/foo2.txt" > "${B}/bar1.txt" MAIN_DEPENDENCY "${S}/foo1.txt" DEPENDS "${S}/foo2.txt" VERBATIM) add_custom_target(bar1 DEPENDS "${B}/bar1.txt" SOURCES "${S}/foo1.txt" "${S}/foo2.txt") add_custom_command(OUTPUT bar2.txt COMMAND "${CMAKE_COMMAND}" -E md5sum "${S}/foo2.txt" "${S}/foo1.txt" > "${B}/bar2.txt" MAIN_DEPENDENCY "${S}/foo2.txt" DEPENDS "${S}/foo1.txt" VERBATIM) add_custom_target(bar2 DEPENDS "${B}/bar2.txt" SOURCES "${S}/foo1.txt" "${S}/foo2.txt") Now: $ /opt/cmake-3.3.2/bin/cmake /source/dir [...] -- Build files have been written to: /build/dir $ make bar1 Scanning dependencies of target bar1 [ 50%] Generating bar1.txt [100%] Generating bar2.txt [100%] Built target bar1 Even though bar1 doesn't depend on bar2.txt, it gets generated anyway. Similarly, if you make bar2, it will generate bar1.txt. | ||||
Additional Information | |||||
Tags | No tags attached. | ||||
Relationships | |||||
Attached Files | |||||
Issue History | |||||
Date Modified | Username | Field | Change | ||
2015-11-11 15:04 | Роман Донченко | New Issue | |||
2015-11-11 15:21 | Brad King | Note Added: 0039866 | |||
2015-11-11 15:21 | Brad King | Status | new => resolved | ||
2015-11-11 15:21 | Brad King | Resolution | open => no change required | ||
2015-11-16 14:16 | Роман Донченко | Note Added: 0039874 | |||
2015-11-16 14:34 | Brad King | Note Added: 0039875 | |||
2016-05-02 08:30 | Robert Maynard | Note Added: 0040961 | |||
2016-05-02 08:30 | Robert Maynard | Status | resolved => closed |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|