GHS: Use shorter object file names on collision
This commit is contained in:
parent
7d2a0aa76c
commit
d7233a0472
|
@ -1,6 +1,7 @@
|
|||
include(Compiler/GHS)
|
||||
|
||||
set(CMAKE_C_VERBOSE_FLAG "-v")
|
||||
set(CMAKE_C_OUTPUT_EXTENSION ".o")
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "")
|
||||
set(CMAKE_C_FLAGS_DEBUG_INIT "-Odebug -g")
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
include(Compiler/GHS)
|
||||
|
||||
set(CMAKE_CXX_VERBOSE_FLAG "-v")
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION ".o")
|
||||
|
||||
set(CMAKE_CXX_FLAGS_INIT "")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-Odebug -g")
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "cmSourceFile.h"
|
||||
#include "cmTarget.h"
|
||||
#include <assert.h>
|
||||
#include <cmAlgorithms.h>
|
||||
|
||||
std::string const cmGhsMultiTargetGenerator::DDOption("-dynamic");
|
||||
|
||||
|
@ -466,20 +465,14 @@ cmGhsMultiTargetGenerator::GetObjectNames(
|
|||
for (std::vector<cmSourceFile*>::const_iterator sf =
|
||||
duplicateSources.begin();
|
||||
sf != duplicateSources.end(); ++sf) {
|
||||
static std::string::size_type const MAX_FULL_PATH_LENGTH = 247;
|
||||
std::string const longestObjectDirectory(
|
||||
cmGhsMultiTargetGenerator::ComputeLongestObjectDirectory(
|
||||
localGhsMultiGenerator, generatorTarget, *sf));
|
||||
std::string fullFilename = (*sf)->GetFullPath();
|
||||
bool const ObjPathFound = cmLocalGeneratorCheckObjectName(
|
||||
fullFilename, longestObjectDirectory.size(), MAX_FULL_PATH_LENGTH);
|
||||
if (!ObjPathFound) {
|
||||
cmSystemTools::Error("Object path \"", fullFilename.c_str(),
|
||||
"\" too long", "");
|
||||
}
|
||||
cmsys::SystemTools::ReplaceString(fullFilename, ":/", "_");
|
||||
cmsys::SystemTools::ReplaceString(fullFilename, "/", "_");
|
||||
objectNamesCorrected[*sf] = fullFilename;
|
||||
std::string objFilenameName =
|
||||
localGhsMultiGenerator->GetObjectFileNameWithoutTarget(
|
||||
**sf, longestObjectDirectory);
|
||||
cmsys::SystemTools::ReplaceString(objFilenameName, "/", "_");
|
||||
objectNamesCorrected[*sf] = objFilenameName;
|
||||
}
|
||||
|
||||
return objectNamesCorrected;
|
||||
|
@ -517,8 +510,7 @@ void cmGhsMultiTargetGenerator::WriteSources(
|
|||
this->WriteObjectLangOverride(this->FolderBuildStreams[sgPath], (*si));
|
||||
if (objectNames.end() != objectNames.find(*si)) {
|
||||
*this->FolderBuildStreams[sgPath]
|
||||
<< " -o \"" << objectNames.find(*si)->second << ".o\""
|
||||
<< std::endl;
|
||||
<< " -o \"" << objectNames.find(*si)->second << "\"" << std::endl;
|
||||
}
|
||||
|
||||
this->WriteObjectDir(this->FolderBuildStreams[sgPath],
|
||||
|
|
|
@ -1,7 +1,12 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
project(demo C)
|
||||
|
||||
add_library(libdemo test.c subfolder/test.c)
|
||||
add_library(libdemo
|
||||
test.c
|
||||
subfolder_test.c
|
||||
subfolder_test_0.c
|
||||
"subfolder/test.c"
|
||||
)
|
||||
|
||||
add_executable(demo main.c)
|
||||
target_link_libraries(demo libdemo)
|
||||
|
|
|
@ -1,9 +1,13 @@
|
|||
int test_a(void);
|
||||
int test_b(void);
|
||||
int test_c(void);
|
||||
int test_d(void);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
test_a();
|
||||
test_b();
|
||||
test_c();
|
||||
test_d();
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
int test_c()
|
||||
{
|
||||
return 1;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
|
||||
int test_d()
|
||||
{
|
||||
return 1;
|
||||
}
|
Loading…
Reference in New Issue