summaryrefslogtreecommitdiffstats
path: root/Source/cmCoreTryCompile.h
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2022-09-21 17:34:02 (GMT)
committerMatthew Woehlke <matthew.woehlke@kitware.com>2022-09-22 17:33:27 (GMT)
commitcb14ae2b870e9568d18990992882e0facacf22d4 (patch)
treeb7c203b809fe854610a36b0d97b6299b9d9e18cc /Source/cmCoreTryCompile.h
parent620cf9efa78c8862558ac321c043194d1cb6eb19 (diff)
downloadCMake-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.h7
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,