MantisBT - CMake
View Issue Details
0002828CMakeCMakepublic2006-02-03 12:492011-06-17 12:37
David Cole 
David Cole 
normalfeaturealways
closedfixed 
 
CMake 2.8.5CMake 2.8.5 
0002828: Need more information when running -P cmake scripts...
* query the full path of the running CMake executable (CMAKE_COMMAND and CMAKE_CMAKE_COMMAND and CMAKE_EXECUTABLE_NAME are all empty when -P is used...)

* query the full path of the running CMake script (similar to CTEST_SCRIPT_DIRECTORY and CTEST_SCRIPT_NAME)

* query whether CMake is processing a script or not (query is it processing a CMakeLists for configure/generate or is it processing a -P script...?)

* obtain the CMake command line used to invoke the script (argc, argv style? as in same ability we already have in macros, but to access to CMake command line itself from the script CMAKE_ARGC, etc)

* pass arguments to the script (similar to CTEST_SCRIPT_ARG with ctest -S -- this one is low priority, I can essentially achieve this with extra -D switches)
No tags attached.
gz issue2828.tar.gz (1,463) 2009-12-16 19:14
https://public.kitware.com/Bug/file/2727/issue2828.tar.gz
Issue History
2008-10-01 12:26Bill HoffmanAssigned ToBill Hoffman => David Cole
2009-12-16 19:14David ColeFile Added: issue2828.tar.gz
2009-12-16 19:18David ColeNote Added: 0018935
2011-02-03 12:08David ColeNote Added: 0025243
2011-02-03 12:08David ColeStatusassigned => resolved
2011-02-03 12:08David ColeResolutionopen => fixed
2011-02-16 11:44David ColeTarget Version => CMake 2.8.5
2011-06-06 18:25David ColeStatusresolved => closed
2011-06-06 18:25David ColeNote Added: 0026722
2011-06-17 12:37David ColeFixed in Version => CMake 2.8.5

Notes
(0003850)
Brad King   
2006-03-07 14:47   
This change adds CMAKE_COMMAND, CMAKE_ROOT, and CMAKE_CTEST_COMMAND to the variables available from scripts:

/cvsroot/CMake/CMake/Source/cmake.cxx,v <-- cmake.cxx
new revision: 1.236; previous revision: 1.235
(0018935)
David Cole   
2009-12-16 19:18   
Attached a file with a script in it that demonstrates some of the ideas in this issue's Description...

Updates/notes since issue first reported:
* CMAKE_COMMAND is now available/accurate in script mode
* CMAKE_CURRENT_LIST_FILE gives full path of currently running script
* still no positive indicator about running in script mode, but it appears that CMAKE_PARENT_LIST_FILE is always the empty string in a cmake -P script using cmake 2.8.0 and earlier...
* still no way to retrieve the cmake command line arguments from within a script
* no need to replicate the silly ",args" stuff from ctest -S land into cmake -P land : using -D to define variables is a preferable alternative that works now (as long as you pass the -D args *before* the -P arg on the command line...) :-)
(0025243)
David Cole   
2011-02-03 12:08   
Fix pushed to 'next':

This commit:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=94d1684a8fd0de4310874cd582636a8e26402da2 [^]
adds variable CMAKE_SCRIPT_MODE_FILE whose value is the full path name of the currently being processed -P script when applicable...

This commit:
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=106958c047c9af783b0216916c8e0d8c52595ff6 [^]
adds variables CMAKE_ARGC, CMAKE_ARGV0 ... CMAKE_ARGV[C-1] to allow script processing to analyze command line parameters if it wants to... To be 100% useful, we probably need a "--" syntax also added to the command line processor so that we can tell CMake to ignore command line args beyond a certain point.

But with these additions, this particular issue is as resolved as it can be for now.

R.I.P. 0002828
(0026722)
David Cole   
2011-06-06 18:25   
Closing resolved issues that have not been updated in more than 3 months.