MantisBT - CMake
View Issue Details
0006945CMakeCMakepublic2008-05-02 12:032008-08-19 15:43
Dan Thill 
 
normalmajoralways
closedfixed 
CMake-2-6 
 
0006945: cmake -E chdir processes arguments improperly when arguments match cmake args
Commandline arguments which match those of cmake are not passed to the program. Instead, they are intercepted by cmake and the program is not run.

$ cmake -E chdir / ls --help
cmake version 2.4-patch 8
Usage

  cmake [options] <path-to-source>
  cmake [options] <path-to-existing-build>

Command-Line Options
  -C <initial-cache> = Pre-load a script to populate the cache.
  -D <var>:<type>=<value> = Create a cmake cache entry.
  -G <generator-name> = Specify a makefile generator.

[snip]

Verified on Linux and Windows, on both 2.4.3 and 2.4.8.

This was discovered when I was attempting to add a test case which tested my executable's --help output, e.g.:

ADD_TEST( HelpTest ${CMAKE_COMMAND} -E chdir Prog.exe --help )

WORKAROUND:

Write a CMake script (containing EXECUTE_PROCESS) and test that script instead.

ADD_TEST( HelpTest ${CMAKE_COMMAND} -S HelpTest.cmake )
No tags attached.
related to 0009965closed  cmake -E chdir consumes command arguments when they match cmake arguments 
Issue History
2008-05-02 12:03Dan ThillNew Issue
2008-05-02 12:16Dan ThillNote Added: 0011675
2008-08-19 15:43Bill HoffmanStatusnew => closed
2008-08-19 15:43Bill HoffmanNote Added: 0013081
2008-08-19 15:43Bill HoffmanResolutionopen => fixed
2009-11-24 20:14Bill HoffmanRelationship addedrelated to 0009965

Notes
(0011675)
Dan Thill   
2008-05-02 12:16   
Oops. The line should read:

ADD_TEST( HelpTest ${CMAKE_COMMAND} -E chdir /working/dir Prog.exe --help )
(0013081)
Bill Hoffman   
2008-08-19 15:43   
cvs commit -m "BUG: fix 6647 arguments after -E should not be parsed by CMake"


Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Source/cmDocumentation.cxx,v <-- cmDocumentation.cxx
new revision: 1.71; previous revision: 1.70
/cvsroot/CMake/CMake/Source/cmDocumentation.h,v <-- cmDocumentation.h
new revision: 1.34; previous revision: 1.33
/cvsroot/CMake/CMake/Source/cmakemain.cxx,v <-- cmakemain.cxx
new revision: 1.84; previous revision: 1.83