diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d28229a3ad..d17ea1549b 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -79,6 +79,7 @@ Properties on Targets :maxdepth: 1 /prop_tgt/ALIASED_TARGET + /prop_tgt/ANDROID_GUI /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_NAME_CONFIG diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 097eba34dc..8017b4392f 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -204,6 +204,7 @@ Variables that Control the Build .. toctree:: :maxdepth: 1 + /variable/CMAKE_ANDROID_GUI /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC diff --git a/Help/prop_tgt/ANDROID_GUI.rst b/Help/prop_tgt/ANDROID_GUI.rst new file mode 100644 index 0000000000..90d2428b1f --- /dev/null +++ b/Help/prop_tgt/ANDROID_GUI.rst @@ -0,0 +1,9 @@ +ANDROID_GUI +----------- + +Build an executable as an application package on Android. + +When this property is set to true the executable when built for Android +will be created as an application package. This property is initialized +by the value of the :variable:`CMAKE_ANDROID_GUI` variable if it is set +when a target is created. diff --git a/Help/variable/CMAKE_ANDROID_GUI.rst b/Help/variable/CMAKE_ANDROID_GUI.rst new file mode 100644 index 0000000000..175537527d --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_GUI.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_GUI +----------------- + +Default value for the :prop_tgt:`ANDROID_GUI` target property of +executables. See that target property for additional information. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 80c00206dd..1e2f75ce56 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -446,6 +446,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) { @@ -3504,7 +3508,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; } @@ -3528,7 +3535,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; }