diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d7fcaa5b6..ba20dfc87 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -1546,14 +1546,7 @@ void cmCTest::HandleCommandLineArguments(size_t &i, i < args.size() - 1) { i++; - this->ConfigType = args[i]; - cmSystemTools::ReplaceString(this->ConfigType, ".\\", ""); - if ( !this->ConfigType.empty() ) - { - std::string confTypeEnv - = "CMAKE_CONFIG_TYPE=" + this->ConfigType; - cmSystemTools::PutEnv(confTypeEnv.c_str()); - } + this->SetConfigType(args[i].c_str()); } if(this->CheckArgument(arg, "--debug")) @@ -1848,7 +1841,7 @@ int cmCTest::Run(std::vector &args, std::string* output) #ifdef CMAKE_INTDIR if(this->ConfigType.size() == 0) { - this->ConfigType = CMAKE_INTDIR; + this->SetConfigType(CMAKE_INTDIR); } #endif @@ -2292,6 +2285,16 @@ void cmCTest::AddCTestConfigurationOverwrite(const char* encstr) this->CTestConfigurationOverwrites[key] = value; } +//---------------------------------------------------------------------- +void cmCTest::SetConfigType(const char* ct) +{ + this->ConfigType = ct?ct:""; + cmSystemTools::ReplaceString(this->ConfigType, ".\\", ""); + std::string confTypeEnv + = "CMAKE_CONFIG_TYPE=" + this->ConfigType; + cmSystemTools::PutEnv(confTypeEnv.c_str()); +} + //---------------------------------------------------------------------- bool cmCTest::SetCTestConfigurationFromCMakeVariable(cmMakefile* mf, const char* dconfig, const char* cmake_var) diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 437bb1f33..962431a54 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -269,6 +269,9 @@ public: //! Set the output log file name void SetOutputLogFileName(const char* name); + //! Set the visual studio or Xcode config type + void SetConfigType(const char* ct); + //! Various log types enum { DEBUG = 0, diff --git a/Tests/CTestTest2/test.cmake.in b/Tests/CTestTest2/test.cmake.in index 02217a8d1..c9e263619 100644 --- a/Tests/CTestTest2/test.cmake.in +++ b/Tests/CTestTest2/test.cmake.in @@ -9,7 +9,7 @@ SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Source/kwsys") SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTest2/kwsysBin") SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@") -SET(CTEST_BUILD_CONFIGURATION "Release") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@")