Merge topic 'link-line-quoting'
423009c1
Makefile: Generate single-quoted object lists for Watcoma863a8fe
cmLocalUnixMakefileGenerator3: Re-organize ConvertToQuotedOutputPath
This commit is contained in:
commit
382c9ee859
|
@ -39,6 +39,11 @@ set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG")
|
||||||
set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib")
|
set (CMAKE_C_STANDARD_LIBRARIES_INIT "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib")
|
||||||
set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
|
set (CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
|
||||||
|
|
||||||
|
foreach(type CREATE_SHARED_LIBRARY CREATE_SHARED_MODULE LINK_EXECUTABLE)
|
||||||
|
set(CMAKE_C_${type}_USE_WATCOM_QUOTE 1)
|
||||||
|
set(CMAKE_CXX_${type}_USE_WATCOM_QUOTE 1)
|
||||||
|
endforeach()
|
||||||
|
|
||||||
set(CMAKE_C_CREATE_IMPORT_LIBRARY
|
set(CMAKE_C_CREATE_IMPORT_LIBRARY
|
||||||
"wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
|
"wlib -c -q -n -b <TARGET_IMPLIB> +<TARGET_QUOTED>")
|
||||||
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
|
set(CMAKE_CXX_CREATE_IMPORT_LIBRARY ${CMAKE_C_CREATE_IMPORT_LIBRARY})
|
||||||
|
|
|
@ -35,7 +35,6 @@ void cmGlobalWatcomWMakeGenerator
|
||||||
mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
|
mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1");
|
||||||
mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&");
|
mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&");
|
||||||
mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
|
mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC");
|
||||||
mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1");
|
|
||||||
mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
|
mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386");
|
||||||
mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
|
mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386");
|
||||||
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
|
this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf, optional);
|
||||||
|
|
|
@ -2181,59 +2181,82 @@ cmLocalUnixMakefileGenerator3
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
std::string
|
std::string
|
||||||
cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p)
|
cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p,
|
||||||
|
bool useWatcomQuote)
|
||||||
{
|
{
|
||||||
|
|
||||||
// Split the path into its components.
|
// Split the path into its components.
|
||||||
std::vector<std::string> components;
|
std::vector<std::string> components;
|
||||||
cmSystemTools::SplitPath(p, components);
|
cmSystemTools::SplitPath(p, components);
|
||||||
|
|
||||||
// Return an empty path if there are no components.
|
// Open the quoted result.
|
||||||
if(components.empty())
|
std::string result;
|
||||||
|
if(useWatcomQuote)
|
||||||
{
|
{
|
||||||
return "\"\"";
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
result = "'";
|
||||||
|
#else
|
||||||
|
result = "\"'";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result = "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Choose a slash direction and fix root component.
|
// Return an empty path if there are no components.
|
||||||
const char* slash = "/";
|
if(!components.empty())
|
||||||
|
{
|
||||||
|
// Choose a slash direction and fix root component.
|
||||||
|
const char* slash = "/";
|
||||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
if(!cmSystemTools::GetForceUnixPaths())
|
if(!cmSystemTools::GetForceUnixPaths())
|
||||||
{
|
{
|
||||||
slash = "\\";
|
slash = "\\";
|
||||||
for(std::string::iterator i = components[0].begin();
|
for(std::string::iterator i = components[0].begin();
|
||||||
i != components[0].end(); ++i)
|
i != components[0].end(); ++i)
|
||||||
{
|
{
|
||||||
if(*i == '/')
|
if(*i == '/')
|
||||||
{
|
{
|
||||||
*i = '\\';
|
*i = '\\';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Begin the quoted result with the root component.
|
// Begin the quoted result with the root component.
|
||||||
std::string result = "\"";
|
result += components[0];
|
||||||
result += components[0];
|
|
||||||
|
|
||||||
// Now add the rest of the components separated by the proper slash
|
// Now add the rest of the components separated by the proper slash
|
||||||
// direction for this platform.
|
// direction for this platform.
|
||||||
bool first = true;
|
bool first = true;
|
||||||
for(unsigned int i=1; i < components.size(); ++i)
|
for(unsigned int i=1; i < components.size(); ++i)
|
||||||
{
|
|
||||||
// Only the last component can be empty to avoid double slashes.
|
|
||||||
if(components[i].length() > 0 || (i == (components.size()-1)))
|
|
||||||
{
|
{
|
||||||
if(!first)
|
// Only the last component can be empty to avoid double slashes.
|
||||||
|
if(components[i].length() > 0 || (i == (components.size()-1)))
|
||||||
{
|
{
|
||||||
result += slash;
|
if(!first)
|
||||||
|
{
|
||||||
|
result += slash;
|
||||||
|
}
|
||||||
|
result += components[i];
|
||||||
|
first = false;
|
||||||
}
|
}
|
||||||
result += components[i];
|
|
||||||
first = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close the quoted result.
|
// Close the quoted result.
|
||||||
result += "\"";
|
if(useWatcomQuote)
|
||||||
|
{
|
||||||
|
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||||
|
result += "'";
|
||||||
|
#else
|
||||||
|
result += "'\"";
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
result += "\"";
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,7 +186,8 @@ public:
|
||||||
const char *targetDir,
|
const char *targetDir,
|
||||||
cmLocalGenerator::RelativeRoot returnDir);
|
cmLocalGenerator::RelativeRoot returnDir);
|
||||||
|
|
||||||
static std::string ConvertToQuotedOutputPath(const char* p);
|
static std::string ConvertToQuotedOutputPath(const char* p,
|
||||||
|
bool useWatcomQuote);
|
||||||
|
|
||||||
std::string CreateMakeVariable(const std::string& sin,
|
std::string CreateMakeVariable(const std::string& sin,
|
||||||
const std::string& s2in);
|
const std::string& s2in);
|
||||||
|
|
|
@ -290,6 +290,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
linkRuleVar += linkLanguage;
|
linkRuleVar += linkLanguage;
|
||||||
linkRuleVar += "_LINK_EXECUTABLE";
|
linkRuleVar += "_LINK_EXECUTABLE";
|
||||||
std::string linkRule = this->GetLinkRule(linkRuleVar);
|
std::string linkRule = this->GetLinkRule(linkRuleVar);
|
||||||
|
bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE");
|
||||||
std::vector<std::string> commands1;
|
std::vector<std::string> commands1;
|
||||||
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
|
cmSystemTools::ExpandListArgument(linkRule, real_link_commands);
|
||||||
if(this->Target->IsExecutableWithExports())
|
if(this->Target->IsExecutableWithExports())
|
||||||
|
@ -343,7 +344,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
|
||||||
// rule.
|
// rule.
|
||||||
std::string buildObjs;
|
std::string buildObjs;
|
||||||
this->CreateObjectLists(useLinkScript, false,
|
this->CreateObjectLists(useLinkScript, false,
|
||||||
useResponseFileForObjects, buildObjs, depends);
|
useResponseFileForObjects, buildObjs, depends,
|
||||||
|
useWatcomQuote);
|
||||||
|
|
||||||
cmLocalGenerator::RuleVariables vars;
|
cmLocalGenerator::RuleVariables vars;
|
||||||
vars.RuleLauncher = "RULE_LAUNCH_LINK";
|
vars.RuleLauncher = "RULE_LAUNCH_LINK";
|
||||||
|
|
|
@ -458,6 +458,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
this->Target);
|
this->Target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE");
|
||||||
|
|
||||||
// Determine whether a link script will be used.
|
// Determine whether a link script will be used.
|
||||||
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
|
bool useLinkScript = this->GlobalGenerator->GetUseLinkScript();
|
||||||
|
|
||||||
|
@ -553,7 +555,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
|
||||||
// rule.
|
// rule.
|
||||||
std::string buildObjs;
|
std::string buildObjs;
|
||||||
this->CreateObjectLists(useLinkScript, useArchiveRules,
|
this->CreateObjectLists(useLinkScript, useArchiveRules,
|
||||||
useResponseFileForObjects, buildObjs, depends);
|
useResponseFileForObjects, buildObjs, depends,
|
||||||
|
useWatcomQuote);
|
||||||
|
|
||||||
cmLocalGenerator::RuleVariables vars;
|
cmLocalGenerator::RuleVariables vars;
|
||||||
vars.TargetPDB = targetOutPathPDB.c_str();
|
vars.TargetPDB = targetOutPathPDB.c_str();
|
||||||
|
|
|
@ -1349,7 +1349,8 @@ cmMakefileTargetGenerator::AppendProgress(std::vector<std::string>& commands)
|
||||||
void
|
void
|
||||||
cmMakefileTargetGenerator
|
cmMakefileTargetGenerator
|
||||||
::WriteObjectsVariable(std::string& variableName,
|
::WriteObjectsVariable(std::string& variableName,
|
||||||
std::string& variableNameExternal)
|
std::string& variableNameExternal,
|
||||||
|
bool useWatcomQuote)
|
||||||
{
|
{
|
||||||
// Write a make variable assignment that lists all objects for the
|
// Write a make variable assignment that lists all objects for the
|
||||||
// target.
|
// target.
|
||||||
|
@ -1360,8 +1361,6 @@ cmMakefileTargetGenerator
|
||||||
<< "# Object files for target " << this->Target->GetName() << "\n"
|
<< "# Object files for target " << this->Target->GetName() << "\n"
|
||||||
<< variableName << " =";
|
<< variableName << " =";
|
||||||
std::string object;
|
std::string object;
|
||||||
const char* objName =
|
|
||||||
this->Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS");
|
|
||||||
const char* lineContinue =
|
const char* lineContinue =
|
||||||
this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE");
|
this->Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE");
|
||||||
if(!lineContinue)
|
if(!lineContinue)
|
||||||
|
@ -1372,17 +1371,9 @@ cmMakefileTargetGenerator
|
||||||
i != this->Objects.end(); ++i)
|
i != this->Objects.end(); ++i)
|
||||||
{
|
{
|
||||||
*this->BuildFileStream << " " << lineContinue << "\n";
|
*this->BuildFileStream << " " << lineContinue << "\n";
|
||||||
if(objName)
|
*this->BuildFileStream <<
|
||||||
{
|
this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(),
|
||||||
*this->BuildFileStream <<
|
useWatcomQuote);
|
||||||
this->Convert(*i, cmLocalGenerator::START_OUTPUT,
|
|
||||||
cmLocalGenerator::MAKEFILE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*this->BuildFileStream <<
|
|
||||||
this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*this->BuildFileStream << "\n";
|
*this->BuildFileStream << "\n";
|
||||||
|
|
||||||
|
@ -1404,17 +1395,9 @@ cmMakefileTargetGenerator
|
||||||
*this->BuildFileStream
|
*this->BuildFileStream
|
||||||
<< " " << lineContinue << "\n"
|
<< " " << lineContinue << "\n"
|
||||||
<< this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
|
<< this->Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME");
|
||||||
if(objName)
|
*this->BuildFileStream <<
|
||||||
{
|
this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str(),
|
||||||
*this->BuildFileStream <<
|
useWatcomQuote);
|
||||||
this->Convert(*i, cmLocalGenerator::START_OUTPUT,
|
|
||||||
cmLocalGenerator::MAKEFILE);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
*this->BuildFileStream <<
|
|
||||||
this->LocalGenerator->ConvertToQuotedOutputPath(i->c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
*this->BuildFileStream << "\n" << "\n";
|
*this->BuildFileStream << "\n" << "\n";
|
||||||
}
|
}
|
||||||
|
@ -1882,11 +1865,13 @@ void
|
||||||
cmMakefileTargetGenerator
|
cmMakefileTargetGenerator
|
||||||
::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
::CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
||||||
bool useResponseFile, std::string& buildObjs,
|
bool useResponseFile, std::string& buildObjs,
|
||||||
std::vector<std::string>& makefile_depends)
|
std::vector<std::string>& makefile_depends,
|
||||||
|
bool useWatcomQuote)
|
||||||
{
|
{
|
||||||
std::string variableName;
|
std::string variableName;
|
||||||
std::string variableNameExternal;
|
std::string variableNameExternal;
|
||||||
this->WriteObjectsVariable(variableName, variableNameExternal);
|
this->WriteObjectsVariable(variableName, variableNameExternal,
|
||||||
|
useWatcomQuote);
|
||||||
if(useResponseFile)
|
if(useResponseFile)
|
||||||
{
|
{
|
||||||
// MSVC response files cannot exceed 128K.
|
// MSVC response files cannot exceed 128K.
|
||||||
|
|
|
@ -113,7 +113,8 @@ protected:
|
||||||
|
|
||||||
// write out the variable that lists the objects for this target
|
// write out the variable that lists the objects for this target
|
||||||
void WriteObjectsVariable(std::string& variableName,
|
void WriteObjectsVariable(std::string& variableName,
|
||||||
std::string& variableNameExternal);
|
std::string& variableNameExternal,
|
||||||
|
bool useWatcomQuote);
|
||||||
void WriteObjectsString(std::string& buildObjs);
|
void WriteObjectsString(std::string& buildObjs);
|
||||||
void WriteObjectsStrings(std::vector<std::string>& objStrings,
|
void WriteObjectsStrings(std::vector<std::string>& objStrings,
|
||||||
std::string::size_type limit = std::string::npos);
|
std::string::size_type limit = std::string::npos);
|
||||||
|
@ -172,7 +173,8 @@ protected:
|
||||||
/** Create lists of object files for linking and cleaning. */
|
/** Create lists of object files for linking and cleaning. */
|
||||||
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
void CreateObjectLists(bool useLinkScript, bool useArchiveRules,
|
||||||
bool useResponseFile, std::string& buildObjs,
|
bool useResponseFile, std::string& buildObjs,
|
||||||
std::vector<std::string>& makefile_depends);
|
std::vector<std::string>& makefile_depends,
|
||||||
|
bool useWatcomQuote);
|
||||||
|
|
||||||
void AddIncludeFlags(std::string& flags, const std::string& lang);
|
void AddIncludeFlags(std::string& flags, const std::string& lang);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue