diff options
Diffstat (limited to 'Source/cmTarget.cxx')
-rw-r--r-- | Source/cmTarget.cxx | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index f4714a9..b476a27 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -257,6 +257,7 @@ cmTarget::cmTarget() #endif this->HaveInstallRule = false; this->DLLPlatform = false; + this->IsAndroid = false; this->IsApple = false; this->IsImportedTarget = false; this->BuildInterfaceIncludesAppended = false; @@ -312,12 +313,18 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW")); + // Check whether we are targeting an Android platform. + this->IsAndroid = + strcmp(this->Makefile->GetSafeDefinition("CMAKE_SYSTEM_NAME"), + "Android") == 0; + // Check whether we are targeting an Apple platform. this->IsApple = this->Makefile->IsOn("APPLE"); // Setup default property values. if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) { + this->SetPropertyDefault("ANDROID_API", 0); this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); @@ -440,6 +447,10 @@ void cmTarget::SetMakefile(cmMakefile* mf) this->SetPropertyDefault("VISIBILITY_INLINES_HIDDEN", 0); } + if(this->TargetTypeValue == cmTarget::EXECUTABLE) + { + this->SetPropertyDefault("ANDROID_GUI", 0); + } if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY || this->TargetTypeValue == cmTarget::MODULE_LIBRARY) { @@ -3493,7 +3504,10 @@ const char* cmTarget::GetSuffixVariableInternal(bool implib) const case cmTarget::EXECUTABLE: return (implib ? "CMAKE_IMPORT_LIBRARY_SUFFIX" - : "CMAKE_EXECUTABLE_SUFFIX"); + // Android GUI application packages store the native + // binary as a shared library. + : (this->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI")? + "CMAKE_SHARED_LIBRARY_SUFFIX" : "CMAKE_EXECUTABLE_SUFFIX")); default: break; } @@ -3517,7 +3531,12 @@ const char* cmTarget::GetPrefixVariableInternal(bool implib) const ? "CMAKE_IMPORT_LIBRARY_PREFIX" : "CMAKE_SHARED_MODULE_PREFIX"); case cmTarget::EXECUTABLE: - return (implib? "CMAKE_IMPORT_LIBRARY_PREFIX" : ""); + return (implib + ? "CMAKE_IMPORT_LIBRARY_PREFIX" + // Android GUI application packages store the native + // binary as a shared library. + : (this->IsAndroid && this->GetPropertyAsBool("ANDROID_GUI")? + "CMAKE_SHARED_LIBRARY_PREFIX" : "")); default: break; } |