From 3206db15b37c29a4f9d7edd5695db52a885ef3f4 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Fri, 13 Oct 2006 17:10:48 -0400 Subject: ENH: Properly propagate config type to test --- Source/cmCTest.cxx | 21 ++++++++++++--------- Source/cmCTest.h | 3 +++ Tests/CTestTest2/test.cmake.in | 2 +- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d7fcaa5..ba20dfc 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 @@ -2293,6 +2286,16 @@ void cmCTest::AddCTestConfigurationOverwrite(const char* encstr) } //---------------------------------------------------------------------- +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 437bb1f..962431a 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 02217a8..c9e2636 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@") -- cgit v0.12