diff options
author | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-09-21 17:34:02 (GMT) |
---|---|---|
committer | Matthew Woehlke <matthew.woehlke@kitware.com> | 2022-09-22 17:33:27 (GMT) |
commit | cb14ae2b870e9568d18990992882e0facacf22d4 (patch) | |
tree | b7c203b809fe854610a36b0d97b6299b9d9e18cc /Source/cmCoreTryCompile.h | |
parent | 620cf9efa78c8862558ac321c043194d1cb6eb19 (diff) | |
download | CMake-cb14ae2b870e9568d18990992882e0facacf22d4.zip CMake-cb14ae2b870e9568d18990992882e0facacf22d4.tar.gz CMake-cb14ae2b870e9568d18990992882e0facacf22d4.tar.bz2 |
try_compile: Add SOURCE_FROM_{ARG,VAR}
Add ability to "feed" try_compile (and try_run) sources more directly,
either from literal content, or from a CMake variable which contains
literal content. This saves the user from needing a separate step to
write the content to a file, and allows for the sources to only exist in
the scratch directory.
Diffstat (limited to 'Source/cmCoreTryCompile.h')
-rw-r--r-- | Source/cmCoreTryCompile.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmCoreTryCompile.h b/Source/cmCoreTryCompile.h index 729aa9f..75dcf6e 100644 --- a/Source/cmCoreTryCompile.h +++ b/Source/cmCoreTryCompile.h @@ -40,6 +40,10 @@ public: cm::optional<std::string> ProjectName; cm::optional<std::string> TargetName; cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> Sources; + cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> + SourceFromArg; + cm::optional<ArgumentParser::NonEmpty<std::vector<std::string>>> + SourceFromVar; ArgumentParser::MaybeEmpty<std::vector<std::string>> CMakeFlags{ 1, "CMAKE_FLAGS" }; // fake argv[0] @@ -103,6 +107,9 @@ public: cmMakefile* Makefile; private: + std::string WriteSource(std::string const& name, std::string const& content, + char const* command) const; + Arguments ParseArgs( const cmRange<std::vector<std::string>::const_iterator>& args, const cmArgumentParser<Arguments>& parser, |