diff options
author | Brad King <brad.king@kitware.com> | 2014-09-12 13:55:06 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-09-15 14:26:59 (GMT) |
commit | eb7d8156492c353f9972bdf6e2203657f5d6592e (patch) | |
tree | 30eb3dcc6a09032e14044b6866929f86f6ad5093 /Source/cmake.cxx | |
parent | 09c8ad99433df06ed36791bfaef97996cd2de04e (diff) | |
download | CMake-eb7d8156492c353f9972bdf6e2203657f5d6592e.zip CMake-eb7d8156492c353f9972bdf6e2203657f5d6592e.tar.gz CMake-eb7d8156492c353f9972bdf6e2203657f5d6592e.tar.bz2 |
cmake: Add -A option to specify a generator platform
Define the 'cmake -A' option to set CMAKE_GENERATOR_PLATFORM
without having to spell out the whole variable name. We choose
the name '-A' for "platform" because '-P' is already taken, and
in the common use case the "platform" is actually an architecture
(e.g. x64).
Teach the RunCMake test infrastructure to use -A to pass the generator
platform. Extend the RunCMake.GeneratorPlatform test with a case to
verify that the -A option cannot be repeated.
Diffstat (limited to 'Source/cmake.cxx')
-rw-r--r-- | Source/cmake.cxx | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c9c63c7..09d270d 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -639,6 +639,7 @@ void cmake::SetArgs(const std::vector<std::string>& args, { bool directoriesSet = directoriesSetBefore; bool haveToolset = false; + bool havePlatform = false; for(unsigned int i=1; i < args.size(); ++i) { std::string arg = args[i]; @@ -767,6 +768,27 @@ void cmake::SetArgs(const std::vector<std::string>& args, "uninitialized variables.\n"; this->SetCheckSystemVars(true); } + else if(arg.find("-A",0) == 0) + { + std::string value = arg.substr(2); + if(value.size() == 0) + { + ++i; + if(i >= args.size()) + { + cmSystemTools::Error("No platform specified for -A"); + return; + } + value = args[i]; + } + if(havePlatform) + { + cmSystemTools::Error("Multiple -A options not allowed"); + return; + } + this->GeneratorPlatform = value; + havePlatform = true; + } else if(arg.find("-T",0) == 0) { std::string value = arg.substr(2); |