MantisBT - CMake
View Issue Details
0012297CMakeCMakepublic2011-06-22 07:342012-01-02 15:56
Tim Cera 
David Cole 
normalminoralways
closedno change required 
 
CMake 2.8.5CMake 2.8.5 
0012297: Documentation recommendation
After a lot of puzzling work, and only from searching the mailing list, did I discover that the file() command only works at the 'cmake' level, not the 'make'.

Haven't yet figured out how to do what I want, BUT it would be nice to separate the 'cmake' level functions from the 'make' level functions in the documentation. If you want to keep them together, at least make it very clear in what context they run.
No tags attached.
Issue History
2011-06-22 07:34Tim CeraNew Issue
2011-06-22 08:15David ColeNote Added: 0026946
2011-06-22 08:32Tim CeraNote Added: 0026948
2011-06-22 08:43David ColeNote Added: 0026949
2011-06-22 08:43David ColeStatusnew => resolved
2011-06-22 08:43David ColeFixed in Version => CMake 2.8.5
2011-06-22 08:43David ColeResolutionopen => no change required
2011-06-22 08:43David ColeAssigned To => David Cole
2011-06-22 09:02Tim CeraNote Added: 0026950
2011-06-22 09:02Tim CeraStatusresolved => feedback
2011-06-22 09:02Tim CeraResolutionno change required => reopened
2011-06-22 09:40David ColeNote Added: 0026951
2011-07-05 10:41David ColeNote Added: 0027008
2011-07-05 10:41David ColeStatusfeedback => resolved
2011-07-05 10:41David ColeResolutionreopened => no change required
2011-07-08 17:55David ColeTarget Version => CMake 2.8.5
2012-01-02 15:56David ColeNote Added: 0028096
2012-01-02 15:56David ColeStatusresolved => closed

Notes
(0026946)
David Cole   
2011-06-22 08:15   
I'm not sure I understand your confusion... All CMake commands are 'cmake' level commands.

Can you give me an example of what you mean by a 'make' level command?
(0026948)
Tim Cera   
2011-06-22 08:32   
See the following e-mail:
http://www.cmake.org/pipermail/cmake/2010-September/039927.html [^]

The file() functions only run if you regenerate the files for your build environment using 'cmake' or regeneration is triggered by editing CMakeLists.txt.

Everything worked fine the first time I ran 'make' if I edited the CMakeLists.txt file which triggers a regeneration of the build files. The second time I ran 'make' (or 'make install') it wouldn't work.

I expected file() functions to run EVERY time I ran 'make' - not just after editing CMakeLists.txt.

If file() is the only command affected - just a note in the documentation would be great. If several commands are like this, then I suggest making a separate section.

Kindest regards,
Tim
(0026949)
David Cole   
2011-06-22 08:43   
All cmake commands are "cmake level" commands when they are used in the context of a CMakeLists.txt file. They will only run when cmake is run to configure the project, or when cmake is re-run as part of a make because a CMakeLists.txt file changed.

If you write a cmake script, and invoke it via "cmake -P script.cmake" as an add_custom_command build step, then that script will run at build time whenever its inputs change. If you do this, then the script will run at build time.

The file command needs nothing special in the documentation: all CMake commands are like this.
(0026950)
Tim Cera   
2011-06-22 09:02   
I am still learning 'cmake', but I think there is a difference between file() and most (maybe all) other functions.

For example add_custom_command() creates some feature in the build system that does something during the build. The file() command does not.
(0026951)
David Cole   
2011-06-22 09:40   
A discussion in the bug tracker is not really the ideal way to learn CMake.

Perhaps more questions on the mailing list would be in order. There, you have thousands of people who might be able to help you out.

Here you have me telling you that all CMake commands are the same and file does not need any special documentation.

add_custom_command and add_custom_target (and add_library and add_executable) are the "special" commands that cause something to happen at build time. I believe those commands are documented appropriately.

Please take this to the mailing list so you have an audience larger than 1. Thanks.
(0027008)
David Cole   
2011-07-05 10:41   
If you would still like to re-open this issue, please clarify exactly what you would like to see as a bug fix. I'm not sure I understand what sort of fix you're looking for to this issue.
(0028096)
David Cole   
2012-01-02 15:56   
Closing resolved issues that have not been updated in more than 4 months.