View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002828CMakeCMakepublic2006-02-03 12:492011-06-17 12:37
ReporterDavid Cole 
Assigned ToDavid Cole 
PrioritynormalSeverityfeatureReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionCMake 2.8.5Fixed in VersionCMake 2.8.5 
Summary0002828: Need more information when running -P cmake scripts...
Description* 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)
TagsNo tags attached.
Attached Filesgz file icon issue2828.tar.gz [^] (1,463 bytes) 2009-12-16 19:14

 Relationships

  Notes
(0003850)
Brad King (manager)
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 (manager)
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 (manager)
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 (manager)
2011-06-06 18:25

Closing resolved issues that have not been updated in more than 3 months.

 Issue History
Date Modified Username Field Change
2008-10-01 12:26 Bill Hoffman Assigned To Bill Hoffman => David Cole
2009-12-16 19:14 David Cole File Added: issue2828.tar.gz
2009-12-16 19:18 David Cole Note Added: 0018935
2011-02-03 12:08 David Cole Note Added: 0025243
2011-02-03 12:08 David Cole Status assigned => resolved
2011-02-03 12:08 David Cole Resolution open => fixed
2011-02-16 11:44 David Cole Target Version => CMake 2.8.5
2011-06-06 18:25 David Cole Status resolved => closed
2011-06-06 18:25 David Cole Note Added: 0026722
2011-06-17 12:37 David Cole Fixed in Version => CMake 2.8.5


Copyright © 2000 - 2018 MantisBT Team