summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-16 15:39:21 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-04-16 15:39:28 (GMT)
commitbb290fc7a455d014429df452da0c05e83d4f9f34 (patch)
treefd1bf926683be95da21c449d6597c1a99046171b /Source
parent16f213efa3786ecf8ebe15355f17890b54e56ac5 (diff)
parentd5c3e4ac326328dd4ca48b12b27b11ea19d87363 (diff)
downloadCMake-bb290fc7a455d014429df452da0c05e83d4f9f34.zip
CMake-bb290fc7a455d014429df452da0c05e83d4f9f34.tar.gz
CMake-bb290fc7a455d014429df452da0c05e83d4f9f34.tar.bz2
Merge topic 'add_toolchain_cmake_option'
d5c3e4ac32 cmake: add support for --toolchain command argument 13838bbb36 CMAKE_TOOLCHAIN_FILE: Document relative path behavior Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !5991
Diffstat (limited to 'Source')
-rw-r--r--Source/cmake.cxx14
-rw-r--r--Source/cmake.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 1d4bbf4..3b8b70e 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -509,6 +509,16 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
return false;
};
+ auto ToolchainLambda = [&](std::string const& path, cmake* state) -> bool {
+ const std::string var = "CMAKE_TOOLCHAIN_FILE";
+ cmStateEnums::CacheEntryType type = cmStateEnums::FILEPATH;
+#ifndef CMAKE_BOOTSTRAP
+ state->UnprocessedPresetVariables.erase(var);
+#endif
+ state->ProcessCacheArg(var, path, type);
+ return true;
+ };
+
std::vector<CommandArgument> arguments = {
CommandArgument{ "-D", "-D must be followed with VAR=VALUE.",
CommandArgument::Values::One, DefineLambda },
@@ -530,6 +540,8 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args)
CommandArgument{ "-P", "-P must be followed by a file name.",
CommandArgument::Values::One, ScriptLambda },
+ CommandArgument{ "--toolchain", "No file specified for --toolchain",
+ CommandArgument::Values::One, ToolchainLambda },
CommandArgument{ "--install-prefix",
"No install directory specified for --install-prefix",
CommandArgument::Values::One, PrefixLambda },
@@ -835,6 +847,8 @@ void cmake::SetArgs(const std::vector<std::string>& args)
CommandArgument::Values::One, PlatformLambda },
CommandArgument{ "-T", "No toolset specified for -T",
CommandArgument::Values::One, ToolsetLamda },
+ CommandArgument{ "--toolchain", "No file specified for --toolchain",
+ CommandArgument::Values::One, IgnoreAndTrueLambda },
CommandArgument{ "--install-prefix",
"No install directory specified for --install-prefix",
CommandArgument::Values::One, IgnoreAndTrueLambda },
diff --git a/Source/cmake.h b/Source/cmake.h
index ab2ed21..9b29098 100644
--- a/Source/cmake.h
+++ b/Source/cmake.h
@@ -712,6 +712,8 @@ private:
"Specify toolset name if supported by generator." }, \
{ "-A <platform-name>", \
"Specify platform name if supported by generator." }, \
+ { "--toolchain <file>", \
+ "Specify toolchain file [CMAKE_TOOLCHAIN_FILE]." }, \
{ "--install-prefix <directory>", \
"Specify install directory [CMAKE_INSTALL_PREFIX]." }, \
{ "-Wdev", "Enable developer warnings." }, \