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());
|
tgt = this->ConvertToMakeTarget(tgt.c_str());
|
||||||
if(depends.empty())
|
if(depends.empty())
|
||||||
{
|
{
|
||||||
fout << tgt.c_str() << ":\n";
|
fout << tgt.c_str() << " :\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2599,7 +2599,7 @@ void cmLocalUnixMakefileGenerator::OutputMakeRule(std::ostream& fout,
|
||||||
replace = *dep;
|
replace = *dep;
|
||||||
m_Makefile->ExpandVariablesInString(replace);
|
m_Makefile->ExpandVariablesInString(replace);
|
||||||
replace = this->ConvertToMakeTarget(replace.c_str());
|
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;
|
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(program.size() < 1)
|
||||||
|
|
||||||
if(args.size() < 1)
|
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<const char*> argv;
|
std::vector<const char*> argv;
|
||||||
|
argv.push_back(program.c_str());
|
||||||
for(std::vector<cmStdString>::const_iterator a = args.begin();
|
for(std::vector<cmStdString>::const_iterator a = args.begin();
|
||||||
a != args.end(); ++a)
|
a != args.end(); ++a)
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
|
||||||
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
||||||
LINK_LIBRARIES(${COMPLEX_LIBS})
|
LINK_LIBRARIES(${COMPLEX_LIBS})
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(A A.cxx)
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
|
|
|
@ -111,7 +111,35 @@ int main()
|
||||||
lib += CMAKE_INTDIR;
|
lib += CMAKE_INTDIR;
|
||||||
lib += "/";
|
lib += "/";
|
||||||
#endif
|
#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 += cmDynamicLoader::LibPrefix();
|
||||||
lib += "CMakeTestModule";
|
lib += "CMakeTestModule";
|
||||||
lib += cmDynamicLoader::LibExtension();
|
lib += cmDynamicLoader::LibExtension();
|
||||||
|
|
|
@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
|
||||||
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
||||||
LINK_LIBRARIES(${COMPLEX_LIBS})
|
LINK_LIBRARIES(${COMPLEX_LIBS})
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(A A.cxx)
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
|
|
|
@ -111,7 +111,35 @@ int main()
|
||||||
lib += CMAKE_INTDIR;
|
lib += CMAKE_INTDIR;
|
||||||
lib += "/";
|
lib += "/";
|
||||||
#endif
|
#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 += cmDynamicLoader::LibPrefix();
|
||||||
lib += "CMakeTestModule";
|
lib += "CMakeTestModule";
|
||||||
lib += cmDynamicLoader::LibExtension();
|
lib += cmDynamicLoader::LibExtension();
|
||||||
|
|
|
@ -11,7 +11,7 @@ LINK_DIRECTORIES(${Complex_BINARY_DIR}/../../Source/kwsys)
|
||||||
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
SET(COMPLEX_LIBS CMakeTestLibrary;CMakeTestLibraryShared;CMakeTestCLibraryShared)
|
||||||
LINK_LIBRARIES(${COMPLEX_LIBS})
|
LINK_LIBRARIES(${COMPLEX_LIBS})
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(A A.cxx)
|
||||||
ADD_EXECUTABLE(complex complex)
|
ADD_EXECUTABLE(complex complex)
|
||||||
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
ADD_EXECUTABLE(complex.file complex.file.cxx)
|
||||||
IF (UNIX)
|
IF (UNIX)
|
||||||
|
|
|
@ -111,7 +111,35 @@ int main()
|
||||||
lib += CMAKE_INTDIR;
|
lib += CMAKE_INTDIR;
|
||||||
lib += "/";
|
lib += "/";
|
||||||
#endif
|
#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 += cmDynamicLoader::LibPrefix();
|
||||||
lib += "CMakeTestModule";
|
lib += "CMakeTestModule";
|
||||||
lib += cmDynamicLoader::LibExtension();
|
lib += cmDynamicLoader::LibExtension();
|
||||||
|
|
Loading…
Reference in New Issue