cmEnableTestingCommand.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. file Copyright.txt or https://cmake.org/licensing for details. */
  3. #ifndef cmEnableTestingCommand_h
  4. #define cmEnableTestingCommand_h
  5. #include "cmConfigure.h" // IWYU pragma: keep
  6. #include <string>
  7. #include <vector>
  8. #include "cm_memory.hxx"
  9. #include "cmCommand.h"
  10. class cmExecutionStatus;
  11. /** \class cmEnableTestingCommand
  12. * \brief Enable testing for this directory and below.
  13. *
  14. * Produce the output testfile. This produces a file in the build directory
  15. * called CMakeTestfile with a syntax similar to CMakeLists.txt. It contains
  16. * the SUBDIRS() and ADD_TEST() commands from the source CMakeLists.txt
  17. * file with CMake variables expanded. Only the subdirs and tests
  18. * within the valid control structures are replicated in Testfile
  19. * (i.e. SUBDIRS() and ADD_TEST() commands within IF() commands that are
  20. * not entered by CMake are not replicated in Testfile).
  21. * Note that CTest expects to find this file in the build directory root;
  22. * therefore, this command should be in the source directory root too.
  23. */
  24. class cmEnableTestingCommand : public cmCommand
  25. {
  26. public:
  27. /**
  28. * This is a virtual constructor for the command.
  29. */
  30. std::unique_ptr<cmCommand> Clone() override
  31. {
  32. return cm::make_unique<cmEnableTestingCommand>();
  33. }
  34. /**
  35. * This is called when the command is first encountered in
  36. * the CMakeLists.txt file.
  37. */
  38. bool InitialPass(std::vector<std::string> const&,
  39. cmExecutionStatus&) override;
  40. };
  41. #endif