diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 52e4beb2d..a3210a970 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -258,6 +258,9 @@ Options ``--build-generator`` Specify the generator to use. +``--build-generator-platform`` + Specify the generator-specific platform. + ``--build-generator-toolset`` Specify the generator-specific toolset. diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx index 627832ce6..ece46973e 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.cxx +++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx @@ -68,6 +68,12 @@ int cmCTestBuildAndTestHandler::RunCMake(std::string* outstring, generator += this->BuildGenerator; args.push_back(generator); } + if(!this->BuildGeneratorPlatform.empty()) + { + std::string platform = "-DCMAKE_GENERATOR_PLATFORM="; + platform += this->BuildGeneratorPlatform; + args.push_back(platform); + } if(this->BuildGeneratorToolset.size()) { std::string toolset = "-T"; @@ -246,6 +252,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring) // Make the generator available for the Build call below. cm.SetGlobalGenerator(cm.CreateGlobalGenerator( this->BuildGenerator)); + cm.SetGeneratorPlatform(this->BuildGeneratorPlatform); cm.SetGeneratorToolset(this->BuildGeneratorToolset); // Load the cache to make CMAKE_MAKE_PROGRAM available. @@ -490,6 +497,12 @@ int cmCTestBuildAndTestHandler::ProcessCommandLineArguments( idx++; this->BuildGenerator = allArgs[idx]; } + if(currentArg == "--build-generator-platform" && + idx < allArgs.size() - 1) + { + idx++; + this->BuildGeneratorPlatform = allArgs[idx]; + } if(currentArg == "--build-generator-toolset" && idx < allArgs.size() - 1) { diff --git a/Source/CTest/cmCTestBuildAndTestHandler.h b/Source/CTest/cmCTestBuildAndTestHandler.h index d1e9a4d19..5a7b9168f 100644 --- a/Source/CTest/cmCTestBuildAndTestHandler.h +++ b/Source/CTest/cmCTestBuildAndTestHandler.h @@ -57,6 +57,7 @@ protected: std::string Output; std::string BuildGenerator; + std::string BuildGeneratorPlatform; std::string BuildGeneratorToolset; std::vector BuildOptions; bool BuildTwoConfig; diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 1aa876897..8ab503702 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -118,6 +118,15 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() cmakeConfigureCommand += cmakeGeneratorName; cmakeConfigureCommand += "\""; + const char* cmakeGeneratorPlatform = + this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_PLATFORM"); + if(cmakeGeneratorPlatform && *cmakeGeneratorPlatform) + { + cmakeConfigureCommand += " \"-DCMAKE_GENERATOR_PLATFORM="; + cmakeConfigureCommand += cmakeGeneratorPlatform; + cmakeConfigureCommand += "\""; + } + const char* cmakeGeneratorToolset = this->Makefile->GetDefinition("CTEST_CMAKE_GENERATOR_TOOLSET"); if(cmakeGeneratorToolset && *cmakeGeneratorToolset) diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 2c72b4d25..fb97af606 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -86,6 +86,7 @@ static const char * cmDocumentationOptions[][2] = {"--build-two-config", "Run CMake twice"}, {"--build-exe-dir", "Specify the directory for the executable."}, {"--build-generator", "Specify the generator to use."}, + {"--build-generator-platform", "Specify the generator-specific platform."}, {"--build-generator-toolset", "Specify the generator-specific toolset."}, {"--build-project", "Specify the name of the project to build."}, {"--build-makeprogram", "Specify the make program to use."},