create_test_sourcelist.rst 1.5 KB

1234567891011121314151617181920212223242526272829
  1. create_test_sourcelist
  2. ----------------------
  3. Create a test driver and source list for building test programs.
  4. .. code-block:: cmake
  5. create_test_sourcelist(sourceListName driverName
  6. test1 test2 test3
  7. EXTRA_INCLUDE include.h
  8. FUNCTION function)
  9. A test driver is a program that links together many small tests into a single
  10. executable. This is useful when building static executables with large
  11. libraries to shrink the total required size. The list of source files needed
  12. to build the test driver will be in ``sourceListName``. ``driverName`` is the
  13. name of the test driver program. The rest of the arguments consist of a list
  14. of test source files, can be semicolon separated. Each test source file
  15. should have a function in it that is the same name as the file with no
  16. extension (foo.cxx should have int foo(int, char*[]);) ``driverName`` will be
  17. able to call each of the tests by name on the command line. If
  18. ``EXTRA_INCLUDE`` is specified, then the next argument is included into the
  19. generated file. If ``FUNCTION`` is specified, then the next argument is taken
  20. as a function name that is passed a pointer to ac and av. This can be used to
  21. add extra command line processing to each test. The
  22. ``CMAKE_TESTDRIVER_BEFORE_TESTMAIN`` cmake variable can be set to have code
  23. that will be placed directly before calling the test main function.
  24. ``CMAKE_TESTDRIVER_AFTER_TESTMAIN`` can be set to have code that will be
  25. placed directly after the call to the test main function.