Teach find_(path|file) about Linux multiarch (#13742)

Implement support for multiarch include directories as specified here:

  https://wiki.ubuntu.com/MultiarchCross

Generalize the multiarch feature added in commit b41ad3b3 (Teach
find_(library|package) about Linux multiarch, 2011-06-08) to the
find_path and find_file commands.  Teach them to search
<prefix>/include/<arch> whenever they would search <prefix>/include.
This commit is contained in:
Brad King 2012-11-26 16:44:56 -05:00
parent e574852120
commit b96f6fc2aa
2 changed files with 6 additions and 4 deletions

View File

@ -360,13 +360,13 @@ void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths,
{ {
dir += "/"; dir += "/";
} }
if(subdir == "lib") if(subdir == "include" || subdir == "lib")
{ {
const char* arch = const char* arch =
this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE"); this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE");
if(arch && *arch) if(arch && *arch)
{ {
this->AddPathInternal(dir+"lib/"+arch, pathType); this->AddPathInternal(dir+subdir+"/"+arch, pathType);
} }
} }
std::string add = dir + subdir; std::string add = dir + subdir;

View File

@ -45,8 +45,10 @@ void cmFindPathCommand::GenerateDocumentation()
"SEARCH_XXX", "file in a directory"); "SEARCH_XXX", "file in a directory");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(this->GenericDocumentation,
"XXX_SUBDIR", "include"); "XXX_SUBDIR", "include");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(
"XXX_EXTRA_PREFIX_ENTRY", ""); this->GenericDocumentation,
"XXX_EXTRA_PREFIX_ENTRY",
" <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and\n");
cmSystemTools::ReplaceString(this->GenericDocumentation, cmSystemTools::ReplaceString(this->GenericDocumentation,
"CMAKE_FIND_ROOT_PATH_MODE_XXX", "CMAKE_FIND_ROOT_PATH_MODE_XXX",
"CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"); "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE");