FIX: fix the problem where a target is a single character and nmake gets confused and add a test for it
This commit is contained in:
parent
43bc8a0d63
commit
040f776885
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -111,6 +111,34 @@ 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";
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -111,6 +111,34 @@ 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";
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -111,6 +111,34 @@ 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";
|
||||
|
|
Loading…
Reference in New Issue