summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-03-09 16:08:06 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-03-09 16:08:11 (GMT)
commitc4f9d104269938d8111030a05268b19a0f493098 (patch)
tree155bdfc09b1ee0312206fc30f72d21834b2d9c36 /Source
parent31f3531856ab8ee0cdeaf427224b51abd7714ccc (diff)
parentd9bdcf34efa79dcdea4ded8e90b80a55db69fbf6 (diff)
downloadCMake-c4f9d104269938d8111030a05268b19a0f493098.zip
CMake-c4f9d104269938d8111030a05268b19a0f493098.tar.gz
CMake-c4f9d104269938d8111030a05268b19a0f493098.tar.bz2
Merge topic 'master'
d9bdcf34 Tests: Add x32 tests to test suite 5b6d354f Help: Add notes for topic 'x32-abi' bed9c73d Modules: Add x32-abi support to hard-coded paths 462cf254 Add support for x32-abi Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !532
Diffstat (limited to 'Source')
-rw-r--r--Source/cmExportInstallFileGenerator.cxx4
-rw-r--r--Source/cmFindLibraryCommand.cxx9
-rw-r--r--Source/cmFindPackageCommand.cxx11
-rw-r--r--Source/cmFindPackageCommand.h1
-rw-r--r--Source/cmMakefile.cxx17
-rw-r--r--Source/cmMakefile.h2
6 files changed, 42 insertions, 2 deletions
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 64ea3c8..3b76a87 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -195,8 +195,10 @@ void cmExportInstallFileGenerator::GenerateImportPrefix(std::ostream& os)
<< " \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n";
if (cmHasLiteralPrefix(absDestS.c_str(), "/lib/") ||
cmHasLiteralPrefix(absDestS.c_str(), "/lib64/") ||
+ cmHasLiteralPrefix(absDestS.c_str(), "/libx32/") ||
cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib/") ||
- cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/")) {
+ cmHasLiteralPrefix(absDestS.c_str(), "/usr/lib64/") ||
+ cmHasLiteralPrefix(absDestS.c_str(), "/usr/libx32/")) {
// Handle "/usr move" symlinks created by some Linux distros.
/* clang-format off */
os <<
diff --git a/Source/cmFindLibraryCommand.cxx b/Source/cmFindLibraryCommand.cxx
index 69f9078..e92d672 100644
--- a/Source/cmFindLibraryCommand.cxx
+++ b/Source/cmFindLibraryCommand.cxx
@@ -43,7 +43,8 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
return true;
}
- // add custom lib<qual> paths instead of using fixed lib32 or lib64
+ // add custom lib<qual> paths instead of using fixed lib32, lib64 or
+ // libx32
if (const char* customLib = this->Makefile->GetDefinition(
"CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX")) {
this->AddArchitecturePaths(customLib);
@@ -60,6 +61,12 @@ bool cmFindLibraryCommand::InitialPass(std::vector<std::string> const& argsIn,
"FIND_LIBRARY_USE_LIB64_PATHS")) {
this->AddArchitecturePaths("64");
}
+ // add special 32 bit paths if this is an x32 compile.
+ else if (this->Makefile->PlatformIsx32() &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIBX32_PATHS")) {
+ this->AddArchitecturePaths("x32");
+ }
std::string library = this->FindLibrary();
if (library != "") {
diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx
index 60de74f..4b29837 100644
--- a/Source/cmFindPackageCommand.cxx
+++ b/Source/cmFindPackageCommand.cxx
@@ -92,6 +92,7 @@ cmFindPackageCommand::cmFindPackageCommand()
this->DebugMode = false;
this->UseLib32Paths = false;
this->UseLib64Paths = false;
+ this->UseLibx32Paths = false;
this->PolicyScope = true;
this->VersionMajor = 0;
this->VersionMinor = 0;
@@ -173,6 +174,13 @@ bool cmFindPackageCommand::InitialPass(std::vector<std::string> const& args,
this->UseLib64Paths = true;
}
+ // Lookup whether libx32 paths should be used.
+ if (this->Makefile->PlatformIsx32() &&
+ this->Makefile->GetState()->GetGlobalPropertyAsBool(
+ "FIND_LIBRARY_USE_LIBX32_PATHS")) {
+ this->UseLibx32Paths = true;
+ }
+
// Check if User Package Registry should be disabled
if (this->Makefile->IsOn("CMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY")) {
this->NoUserRegistry = true;
@@ -2002,6 +2010,9 @@ bool cmFindPackageCommand::SearchPrefix(std::string const& prefix_in)
if (this->UseLib64Paths) {
common.push_back("lib64");
}
+ if (this->UseLibx32Paths) {
+ common.push_back("libx32");
+ }
common.push_back("lib");
common.push_back("share");
diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h
index d454892..61a8dd6 100644
--- a/Source/cmFindPackageCommand.h
+++ b/Source/cmFindPackageCommand.h
@@ -169,6 +169,7 @@ private:
bool DebugMode;
bool UseLib32Paths;
bool UseLib64Paths;
+ bool UseLibx32Paths;
bool PolicyScope;
std::string LibraryArchitecture;
std::vector<std::string> Names;
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index 204fd8f..c4a488f 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -2150,6 +2150,12 @@ bool cmMakefile::IsSet(const std::string& name) const
bool cmMakefile::PlatformIs32Bit() const
{
+ if (const char* plat_abi =
+ this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
+ if (strcmp(plat_abi, "ELF X32") == 0) {
+ return false;
+ }
+ }
if (const char* sizeof_dptr = this->GetDefinition("CMAKE_SIZEOF_VOID_P")) {
return atoi(sizeof_dptr) == 4;
}
@@ -2164,6 +2170,17 @@ bool cmMakefile::PlatformIs64Bit() const
return false;
}
+bool cmMakefile::PlatformIsx32() const
+{
+ if (const char* plat_abi =
+ this->GetDefinition("CMAKE_INTERNAL_PLATFORM_ABI")) {
+ if (strcmp(plat_abi, "ELF X32") == 0) {
+ return true;
+ }
+ }
+ return false;
+}
+
bool cmMakefile::PlatformIsAppleIos() const
{
std::string sdkRoot;
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 4d5ce98..4e48c88 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -436,6 +436,8 @@ public:
/** Return whether the target platform is 64-bit. */
bool PlatformIs64Bit() const;
+ /** Return whether the target platform is x32. */
+ bool PlatformIsx32() const;
/** Return whether the target platform is Apple iOS. */
bool PlatformIsAppleIos() const;