summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-22 21:00:00 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-22 21:00:00 (GMT)
commit040f7768859ae974d10ef24670768fce574bb2e4 (patch)
tree42b9e48b578e01521bfe3266e26616fa555bfffd
parent43bc8a0d63705d57481ec7c9cefed1b65402e98f (diff)
downloadCMake-040f7768859ae974d10ef24670768fce574bb2e4.zip
CMake-040f7768859ae974d10ef24670768fce574bb2e4.tar.gz
CMake-040f7768859ae974d10ef24670768fce574bb2e4.tar.bz2
FIX: fix the problem where a target is a single character and nmake gets confused and add a test for it
-rw-r--r--Source/cmLocalUnixMakefileGenerator.cxx4
-rw-r--r--Source/cmSystemTools.cxx9
-rw-r--r--Tests/Complex/Executable/CMakeLists.txt2
-rw-r--r--Tests/Complex/Executable/complex.cxx28
-rw-r--r--Tests/ComplexOneConfig/Executable/CMakeLists.txt2
-rw-r--r--Tests/ComplexOneConfig/Executable/complex.cxx28
-rw-r--r--Tests/ComplexRelativePaths/Executable/CMakeLists.txt2
-rw-r--r--Tests/ComplexRelativePaths/Executable/complex.cxx28
8 files changed, 95 insertions, 8 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator.cxx b/Source/cmLocalUnixMakefileGenerator.cxx
index 80fee93..f00261c 100644
--- a/Source/cmLocalUnixMakefileGenerator.cxx
+++ b/Source/cmLocalUnixMakefileGenerator.cxx
@@ -2587,7 +2587,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
tgt = this->ConvertToMakeTarget(tgt.c_str());
if(depends.empty())
{
- fout << tgt.c_str() << ":\n";
+ fout << tgt.c_str() << " :\n";
}
else
{
@@ -2599,7 +2599,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
replace = *dep;
m_Makefile->ExpandVariablesInString(replace);
replace = this->ConvertToMakeTarget(replace.c_str());
- fout << tgt.c_str() << ": " << replace.c_str() << "\n";
+ fout << tgt.c_str() << " : " << replace.c_str() << "\n";
}
}
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index 26ebdca..18d9c28 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -426,15 +426,18 @@ bool cmSystemTools::RunSingleCommand(
{
verbose = false;
}
+ std::string argsTemp;
+ std::string program;
+ cmSystemTools::SplitProgramFromArgs(command, program, argsTemp);
+ std::vector<cmStdString> args = cmSystemTools::ParseArguments(argsTemp.c_str());
- std::vector<cmStdString> args = cmSystemTools::ParseArguments(command);
-
- if(args.size() < 1)
+ if(program.size() < 1)
{
return false;
}
std::vector<const char*> argv;
+ argv.push_back(program.c_str());
for(std::vector<cmStdString>::const_iterator a = args.begin();
a != args.end(); ++a)
{
diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt
index 26626a6..093ba91 100644
--- a/Tests/Complex/Executable/CMakeLists.txt
+++ b/Tests/Complex/Executable/CMakeLists.txt
@@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-
+ADD_EXECUTABLE(A A.cxx)
ADD_EXECUTABLE(complex complex)
ADD_EXECUTABLE(complex.file complex.file.cxx)
IF (UNIX)
diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx
index adf99d7..441a291 100644
--- a/Tests/Complex/Executable/complex.cxx
+++ b/Tests/Complex/Executable/complex.cxx
@@ -111,7 +111,35 @@ int main()
lib += CMAKE_INTDIR;
lib += "/";
#endif
+ std::string exe = lib;
+ // Test a single character executable to test a: in makefiles
+ exe += "A";
+ exe += cmSystemTools::GetExecutableExtension();
+ int ret;
+ std::string errorMessage;
+ if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret))
+ {
+ if(ret != 10)
+ {
+ errorMessage += exe;
+ errorMessage += " did not return 10";
+ }
+ }
+ else
+ {
+ errorMessage += exe;
+ errorMessage += ": failed to run.";
+ }
+ if(errorMessage.size())
+ {
+ cmFailed(errorMessage.c_str());
+ }
+ else
+ {
+ cmPassed("run Single Character executable A returned 10 as expected.");
+ }
+
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();
diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
index 26626a6..093ba91 100644
--- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt
+++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt
@@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-
+ADD_EXECUTABLE(A A.cxx)
ADD_EXECUTABLE(complex complex)
ADD_EXECUTABLE(complex.file complex.file.cxx)
IF (UNIX)
diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx
index adf99d7..441a291 100644
--- a/Tests/ComplexOneConfig/Executable/complex.cxx
+++ b/Tests/ComplexOneConfig/Executable/complex.cxx
@@ -111,7 +111,35 @@ int main()
lib += CMAKE_INTDIR;
lib += "/";
#endif
+ std::string exe = lib;
+ // Test a single character executable to test a: in makefiles
+ exe += "A";
+ exe += cmSystemTools::GetExecutableExtension();
+ int ret;
+ std::string errorMessage;
+ if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret))
+ {
+ if(ret != 10)
+ {
+ errorMessage += exe;
+ errorMessage += " did not return 10";
+ }
+ }
+ else
+ {
+ errorMessage += exe;
+ errorMessage += ": failed to run.";
+ }
+ if(errorMessage.size())
+ {
+ cmFailed(errorMessage.c_str());
+ }
+ else
+ {
+ cmPassed("run Single Character executable A returned 10 as expected.");
+ }
+
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();
diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
index 26626a6..093ba91 100644
--- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
+++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt
@@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
LINK_LIBRARIES(${COMPLEX_LIBS})
-
+ADD_EXECUTABLE(A A.cxx)
ADD_EXECUTABLE(complex complex)
ADD_EXECUTABLE(complex.file complex.file.cxx)
IF (UNIX)
diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx
index adf99d7..441a291 100644
--- a/Tests/ComplexRelativePaths/Executable/complex.cxx
+++ b/Tests/ComplexRelativePaths/Executable/complex.cxx
@@ -111,7 +111,35 @@ int main()
lib += CMAKE_INTDIR;
lib += "/";
#endif
+ std::string exe = lib;
+ // Test a single character executable to test a: in makefiles
+ exe += "A";
+ exe += cmSystemTools::GetExecutableExtension();
+ int ret;
+ std::string errorMessage;
+ if(cmSystemTools::RunSingleCommand(exe.c_str(), 0, &ret))
+ {
+ if(ret != 10)
+ {
+ errorMessage += exe;
+ errorMessage += " did not return 10";
+ }
+ }
+ else
+ {
+ errorMessage += exe;
+ errorMessage += ": failed to run.";
+ }
+ if(errorMessage.size())
+ {
+ cmFailed(errorMessage.c_str());
+ }
+ else
+ {
+ cmPassed("run Single Character executable A returned 10 as expected.");
+ }
+
lib += cmDynamicLoader::LibPrefix();
lib += "CMakeTestModule";
lib += cmDynamicLoader::LibExtension();