cmake/Source/cmTryRunCommand.h

56 lines
1.4 KiB
C
Raw Normal View History

2016-10-30 18:24:19 +01:00
/* Distributed under the OSI-approved BSD 3-Clause License. See accompanying
file Copyright.txt or https://cmake.org/licensing for details. */
#ifndef cmTryRunCommand_h
#define cmTryRunCommand_h
2018-01-26 17:06:56 +01:00
#include "cmConfigure.h" // IWYU pragma: keep
2017-07-20 19:35:53 +02:00
2017-04-14 19:02:05 +02:00
#include <string>
#include <vector>
2020-02-01 23:06:01 +01:00
#include <cm/memory>
#include "cmCommand.h"
#include "cmCoreTryCompile.h"
2017-04-14 19:02:05 +02:00
class cmExecutionStatus;
/** \class cmTryRunCommand
* \brief Specifies where to install some files
*
2018-10-28 12:09:07 +01:00
* cmTryRunCommand is used to test if source code can be compiled
*/
class cmTryRunCommand : public cmCoreTryCompile
{
public:
/**
* This is a virtual constructor for the command.
*/
2020-02-01 23:06:01 +01:00
std::unique_ptr<cmCommand> Clone() override
{
return cm::make_unique<cmTryRunCommand>();
}
/**
* This is called when the command is first encountered in
* the CMakeLists.txt file.
*/
2016-10-30 18:24:19 +01:00
bool InitialPass(std::vector<std::string> const& args,
2018-01-26 17:06:56 +01:00
cmExecutionStatus& status) override;
private:
2013-03-16 19:13:01 +02:00
void RunExecutable(const std::string& runArgs,
std::string* runOutputContents);
2013-03-16 19:13:01 +02:00
void DoNotRunExecutable(const std::string& runArgs,
const std::string& srcFile,
std::string* runOutputContents);
std::string CompileResultVariable;
std::string RunResultVariable;
std::string OutputVariable;
std::string RunOutputVariable;
std::string CompileOutputVariable;
};
#endif