From 220aea3aee658e59d02c1d6758688a085cf570f4 Mon Sep 17 00:00:00 2001 From: Andy Cedilnik Date: Tue, 11 Nov 2003 12:36:03 -0500 Subject: BUG: Handle -C properly for executables that are not in the project; Fix Bug #344 - ctest -C Debug --- Source/cmCTest.cxx | 64 +++++++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 114ba2d..4b63ad8 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -449,49 +449,45 @@ std::string cmCTest::FindTheExecutable(const char *exe) std::string file; cmSystemTools::SplitProgramPath(exe, dir, file); - if(m_ConfigType != "") - { - if(TryExecutable(dir.c_str(), file.c_str(), &fullPath, - m_ConfigType.c_str())) - { - return fullPath; - } - dir += "/"; - dir += m_ConfigType; - dir += "/"; - dir += file; - cmSystemTools::Error("config type specified on the command line, but test executable not found.", - dir.c_str()); - return ""; - } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,".")) + if(m_ConfigType != "" && + ::TryExecutable(dir.c_str(), file.c_str(), &fullPath, + m_ConfigType.c_str())) { return fullPath; } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"")) + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,".")) { return fullPath; } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Release")) + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"")) { return fullPath; } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Debug")) + if ( m_ConfigType == "" ) { - return fullPath; - } + // No config type, so try to guess it + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Release")) + { + return fullPath; + } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"MinSizeRel")) - { - return fullPath; - } + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"Debug")) + { + return fullPath; + } - if (TryExecutable(dir.c_str(),file.c_str(),&fullPath,"RelWithDebInfo")) - { - return fullPath; + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"MinSizeRel")) + { + return fullPath; + } + + if (::TryExecutable(dir.c_str(),file.c_str(),&fullPath,"RelWithDebInfo")) + { + return fullPath; + } } // if everything else failed, check the users path @@ -503,7 +499,17 @@ std::string cmCTest::FindTheExecutable(const char *exe) return path; } } - + + if ( m_ConfigType != "" ) + { + dir += "/"; + dir += m_ConfigType; + dir += "/"; + dir += file; + cmSystemTools::Error("config type specified on the command line, but test executable not found.", + dir.c_str()); + return ""; + } return fullPath; } -- cgit v0.12