diff options
-rw-r--r-- | Modules/Compiler/GHS-C.cmake | 1 | ||||
-rw-r--r-- | Modules/Compiler/GHS-CXX.cmake | 1 | ||||
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 20 | ||||
-rw-r--r-- | Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Tests/GhsMultiDuplicateSourceFilenames/main.c | 4 | ||||
-rw-r--r-- | Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c | 5 | ||||
-rw-r--r-- | Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c | 5 |
7 files changed, 28 insertions, 15 deletions
diff --git a/Modules/Compiler/GHS-C.cmake b/Modules/Compiler/GHS-C.cmake index 50532ce..3072715 100644 --- a/Modules/Compiler/GHS-C.cmake +++ b/Modules/Compiler/GHS-C.cmake @@ -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") diff --git a/Modules/Compiler/GHS-CXX.cmake b/Modules/Compiler/GHS-CXX.cmake index 2cffa0d..a51591b 100644 --- a/Modules/Compiler/GHS-CXX.cmake +++ b/Modules/Compiler/GHS-CXX.cmake @@ -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") diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 325a86e..5e13d4c 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -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], diff --git a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt index ffdb582..82a014b 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt +++ b/Tests/GhsMultiDuplicateSourceFilenames/CMakeLists.txt @@ -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) diff --git a/Tests/GhsMultiDuplicateSourceFilenames/main.c b/Tests/GhsMultiDuplicateSourceFilenames/main.c index 301a32e..d5b7914 100644 --- a/Tests/GhsMultiDuplicateSourceFilenames/main.c +++ b/Tests/GhsMultiDuplicateSourceFilenames/main.c @@ -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; } diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c new file mode 100644 index 0000000..c552e6a --- /dev/null +++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test.c @@ -0,0 +1,5 @@ + +int test_c() +{ + return 1; +} diff --git a/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c new file mode 100644 index 0000000..170b33d --- /dev/null +++ b/Tests/GhsMultiDuplicateSourceFilenames/subfolder_test_0.c @@ -0,0 +1,5 @@ + +int test_d() +{ + return 1; +} |