diff options
-rw-r--r-- | Source/cmSearchPath.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Source/cmSearchPath.cxx b/Source/cmSearchPath.cxx index 6c53b85..44f37cb 100644 --- a/Source/cmSearchPath.cxx +++ b/Source/cmSearchPath.cxx @@ -179,12 +179,27 @@ void cmSearchPath::AddPrefixPaths(const std::vector<std::string>& paths, cmValue arch = this->FC->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); if (cmNonempty(arch)) { + std::string archNoUnknown = arch; + auto unknownAtPos = archNoUnknown.find("-unknown-"); + bool foundUnknown = unknownAtPos != std::string::npos; + if (foundUnknown) { + // Replace "-unknown-" with "-". + archNoUnknown.replace(unknownAtPos, 9, "-"); + } if (this->FC->Makefile->IsDefinitionSet("CMAKE_SYSROOT") && this->FC->Makefile->IsDefinitionSet( "CMAKE_PREFIX_LIBRARY_ARCHITECTURE")) { + if (foundUnknown) { + this->AddPathInternal(cmStrCat('/', archNoUnknown, dir, subdir), + cmStrCat('/', archNoUnknown, prefix), base); + } this->AddPathInternal(cmStrCat('/', *arch, dir, subdir), cmStrCat('/', *arch, prefix), base); } else { + if (foundUnknown) { + this->AddPathInternal(cmStrCat(dir, subdir, '/', archNoUnknown), + prefix, base); + } this->AddPathInternal(cmStrCat(dir, subdir, '/', *arch), prefix, base); } |