[CMake] Help with non-standard use of CMake

Kyle Edwards kyle.edwards at kitware.com
Wed Jan 2 09:39:39 EST 2019


On Tue, 2019-01-01 at 16:55 -0500, Donald MacQueen [|] wrote:
> No. CMakelists.txt does nothing but download the correct installer
> (32 or 64 bit) from our server, set a bunch of variables, and then
> run CTest.  I invoke the InstallShield installer from a command line
> in a CTest.
> There is no project, no make, no compile, no build. Just set a bunch
> of variables and run CTest.
> I think from what Kyle said I need to migrate(?) this to a script
> that can be called from CTest directly, e.g., ctest -D Experimental
> -S cdash.txt.
> Thanks for the reply.

If CMakeLists.txt is only downloading and running an installer, then
perhaps it would be best to move this step into your CTest dashboard
script as you suggested. Your CMakeLists.txt is generating the
CTestTestfile.cmake file for you, but you can also write this file
yourself with a series of add_test() calls, which would enable you to
completely get rid of CMakeLists.txt.

If you're not comfortable doing this, you can also just do project(foo
LANGUAGES NONE) in your CMakeLists.txt as has already been suggested.

FWIW, the usual convention for CMake scripts is for anything other than
CMakeLists.txt to have a .cmake extension (though this isn't enforced,
it's just a convention.) And the -D argument to CTest isn't necessary
when running a dashboard script. So your CTest invocation would look
like this:

ctest -S dashboard.cmake

You can also have this script run ctest_configure(), which will run
CMake for you (if you decide not to migrate from CMakeLists.txt) so you
don't have to do it in the batch file.

Good luck, and let us know if you have any more questions!

Kyle


More information about the CMake mailing list