There is more

Option keywords (which we have not used in this example) are defined by cmake_parse_arguments to either TRUE or FALSE. A further enhancement of the add_catch_test function could be to also provide the test command as a named argument, which we have omitted for the benefit of a more concise example.

The cmake_parse_arguments command was made available within the CMakeParseArguments.cmake module prior to the release of CMake 3.5. Thus, this recipe can be made to work with earlier versions of CMake by using the include(CMakeParseArguments) command at the top of the cmake/testing.cmake module file.

Get CMake Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.