Add 'ANDROID_API' target property to set Android Target API

Also add a 'CMAKE_ANDROID_API' variable to set the property default.
This commit is contained in:
Brad King 2014-09-02 13:53:26 -04:00
parent 9a4df52aa1
commit c12e46991e
6 changed files with 21 additions and 0 deletions

View File

@ -79,6 +79,7 @@ Properties on Targets
:maxdepth: 1 :maxdepth: 1
/prop_tgt/ALIASED_TARGET /prop_tgt/ALIASED_TARGET
/prop_tgt/ANDROID_API
/prop_tgt/ANDROID_GUI /prop_tgt/ANDROID_GUI
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG
/prop_tgt/ARCHIVE_OUTPUT_DIRECTORY /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY

View File

@ -204,6 +204,7 @@ Variables that Control the Build
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1
/variable/CMAKE_ANDROID_API
/variable/CMAKE_ANDROID_GUI /variable/CMAKE_ANDROID_GUI
/variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY
/variable/CMAKE_AUTOMOC_MOC_OPTIONS /variable/CMAKE_AUTOMOC_MOC_OPTIONS

View File

@ -0,0 +1,7 @@
ANDROID_API
-----------
Set the Android Target API version (e.g. ``15``). The version number
must be a positive decimal integer. This property is initialized by
the value of the :variable:`CMAKE_ANDROID_API` variable if it is set
when a target is created.

View File

@ -0,0 +1,5 @@
CMAKE_ANDROID_API
-----------------
Default value for the :prop_tgt:`ANDROID_API` target property.
See that target property for additional information.

View File

@ -324,6 +324,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
// Setup default property values. // Setup default property values.
if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY) if (this->GetType() != INTERFACE_LIBRARY && this->GetType() != UTILITY)
{ {
this->SetPropertyDefault("ANDROID_API", 0);
this->SetPropertyDefault("INSTALL_NAME_DIR", 0); this->SetPropertyDefault("INSTALL_NAME_DIR", 0);
this->SetPropertyDefault("INSTALL_RPATH", ""); this->SetPropertyDefault("INSTALL_RPATH", "");
this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF"); this->SetPropertyDefault("INSTALL_RPATH_USE_LINK_PATH", "OFF");

View File

@ -724,6 +724,12 @@ void cmVisualStudio10TargetGenerator
ntv += toolset? toolset : "Default"; ntv += toolset? toolset : "Default";
ntv += "</NdkToolchainVersion>\n"; ntv += "</NdkToolchainVersion>\n";
this->WriteString(ntv.c_str(), 2); this->WriteString(ntv.c_str(), 2);
if(const char* api = this->Target->GetProperty("ANDROID_API"))
{
this->WriteString("<AndroidTargetAPI>", 2);
(*this->BuildFileStream ) <<
"android-" << cmVS10EscapeXML(api) << "</AndroidTargetAPI>\n";
}
} }
void cmVisualStudio10TargetGenerator::WriteCustomCommands() void cmVisualStudio10TargetGenerator::WriteCustomCommands()