View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015035 | CMake | CMake | public | 2014-07-23 13:54 | 2016-06-10 14:31 | ||||
Reporter | Daniele E. Domenichelli | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | feature | Reproducibility | have not tried | ||||
Status | closed | Resolution | moved | ||||||
Platform | OS | OS Version | |||||||
Product Version | CMake 3.0 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015035: Build time file copy_if_different | ||||||||
Description | As a follow up to this thread[1], we agreed that in order to create a project that other project can use both from the install and build tree, in some cases it is a good idea to replicate the installation tree or part of it inside the build directory, so that the relative paths are the same when the package is used from the build tree or from the installation. [1]http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10492 [^] file(COPY) copies the file is copied at CMake time, not a build time, and cmake is not triggered when the original file is modified, and therefore the copy is not performed at build time if the file is modified and the just runs make (or "build" for visual studio and other IDEs). Also file(COPY) does not have an option to copy the file only if the file(s) is(are) different and could trigger an unnecessary rebuild. execute_process(COMMAND "${CMAKE_COMMAND} -E copy_if_different") does not trigger unnecessary builds, but it is still in the configure phase configure_file(COPYONLY) still copies the file in the configure phase, but it will trigger a cmake run if the original file was modified. Nonetheless it has a few disadvantages: * It's less discoverable than file(COPY) * It can copy just one file at the time, therefore it is not easy to reproduce an install tree * It triggers a cmake run, that will slow down the build * The files to configure might be the product of some build step and therefore not available during the configure step. At the moment (as far as I know) the only way to do it is to use add_custom_command to execute some external CMake script that runs "${CMAKE_COMMAND} -E copy_if_different", but this require a lot of work to handle the file level and target level dependencies correctly. It would be very useful to be able to copy files at build time only if different, without triggering a cmake run, and with a syntax similar to the install command. I suggest to implement one of the following ideas: * Have an option for the install(FILES/PROGRAMS/DIRECTORY) command that reproduces the install tree in the binary directory, but at build time, and only if the destination file is missing or is different from the source. * Add some modes to the export() command, for example export(FILES/PROGRAMS/DIRECTORY), with the same signature of install(FILES/PROGRAMS/DIRECTORY), and that replicates the behaviour of this command but at build time and in in the similar way as export(EXPORT) replicates the behaviour of install(EXPORT) | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0036444) Brad King (manager) 2014-07-23 14:49 |
See my response in this thread: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10492/focus=10533 [^] |
(0036446) Ben Boeckel (developer) 2014-07-23 15:25 |
The functions in this[1] file could be improved and upstreamed. [1] https://github.com/Kitware/sprokit/blob/master/conf/sprokit-macro-configure.cmake [^] |
(0036469) Brad King (manager) 2014-07-28 10:05 |
Additional in-thread discussion: http://thread.gmane.org/gmane.comp.programming.tools.cmake.devel/10492/focus=10548 [^] |
(0042589) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-07-23 13:54 | Daniele E. Domenichelli | New Issue | |
2014-07-23 14:49 | Brad King | Note Added: 0036444 | |
2014-07-23 15:25 | Ben Boeckel | Note Added: 0036446 | |
2014-07-28 10:05 | Brad King | Note Added: 0036469 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042589 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |