View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0000764 | CMake | public | 2004-04-19 12:14 | 2004-04-28 13:57 | |||||
Reporter | rutt | ||||||||
Assigned To | Ken Martin | ||||||||
Priority | low | Severity | major | Reproducibility | always | ||||
Status | closed | Resolution | no change required | ||||||
Platform | OS | OS Version | |||||||
Product Version | |||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0000764: ADD_CUSTOM_COMMAND and PRE_BUILD | ||||||||
Description | I'm using cmake 1.8.3. I read that ADD_CUSTOM_COMMAND can be used in the following way, quoted from 'cmake --help ADD_CUSTOM_COMMAND': The second signature adds a custom command to a target such as a library or executable. This is useful for performing an operation before or after building the target: ADD_CUSTOM_COMMAND(TARGET target PRE_BUILD | PRE_LINK | POST_BUILD COMMAND command [ARGS [args...]] [COMMENT comment]) This defines a new command that will be associated with building the specified target. When the command will happen is determined by which of the following is specified: PRE_BUILD - run before all other dependencies PRE_LINK - run after other dependencies POST_BUILD - run after the target has been built So I'd like to use the PRE_BUILD to get my custom command to run before any of the dependencies for the named target are built. Here's my sample project: :::::::::::::: CMakeLists.txt :::::::::::::: PROJECT(dummyproj) ADD_LIBRARY(dummylib SHARED foo.cpp) ADD_CUSTOM_COMMAND( TARGET dummylib PRE_BUILD COMMAND cp ARGS -v /etc/hosts ${dummyproj_BINARY_DIR}) :::::::::::::: foo.cpp :::::::::::::: class Foo { int a; int b; }; So I'd like the 'cp' command to execute before any dependencies of dummylib are built. Yet the output shows that the 'cp' command is happening after foo.o and libdummylib.so are built. I'd like the 'cp' command to happen before both of them are built. What am I doing wrong? $ cmake ../dummyproj -- Check for working C compiler: gcc -- Check for working C compiler: gcc -- works -- Check for working CXX compiler: g++ -- Check for working CXX compiler: g++ -- works -- Configuring done -- Generating done $ make Building dependencies. cmake.depends... cmake.depends is up-to-date Building object file foo.o... Building shared library libdummylib.so... `/etc/hosts' -> `/home/rutt/dev/dummyproj/build/hosts' | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | |||||||||
Relationships | |
Relationships |
Notes | |
(0000925) Bill Hoffman (manager) 2004-04-21 15:15 |
I guess we should just remove this option, or change the docs so it can stay around for backwards compatibility. I do not think it is possible to implement a makefile that does pre_build correctly. |
(0000946) Ken Martin (developer) 2004-04-22 16:33 |
I have updated the docs for this command to indicate the limitation of the PRE_BUILD option. We think we can add this functionality to makefile builds as well but it is a little complicated and will have to wait until CMake 2.2. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |