Greetings,<div><br></div><div>I have noticed that it is possible to run in to problems with CMake when sub directories or test names contain spaces. CMake initially parses quote delimited strings correctly, however it writes them without quotes into the generated CTestTestfile.cmake files which then causes problems when CTest is run.</div>
<div><br></div><div>Please find attached a small example and also a potential fix, in git patch format.</div><div><br></div><div>To see the example in action, configure and generate a build using CMake with the "src" folder as source root, then try to run CTest within the build root. No tests can be found. There are actually 2 issues with the results of CMake. Firstly, in CTestTestfile.cmake in the build root the command SUBDIRS(Sub Dir) is incorrect. If you change it to SUBDIRS("Sub Dir") there is still a problem with the ADD_TEST commands in the "Sub Dir" directory's CTestTestfile.cmake of the build. Again, the test name needs to be delimited with quotes. Once this is fixed to: ADD_TEST("Run Test" ... then CTest can correctly parse and run the specified test.</div>
<div><br></div><div>The patch I have prepared simply wraps all test names and subdirectory names with quotes as they are written to the CTestTestFile. There may be more places where similar fixes would be appropriate if anyone knows of any.</div>
<div><br></div><div>I hope someone might be able to review and submit this fix, as I do not have push privileges for the cmake repository.</div><div><br></div><div>Finally, a big thank you to all involved with CMake for producing such a great development tool.</div>
<div><br></div><div>Regards,</div><div><br></div><div>Edmund Fokschaner</div>