From c12e46991e02c2ea59864512d2c1fb7c2b4b0f9d Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 2 Sep 2014 13:53:26 -0400 Subject: Add 'ANDROID_API' target property to set Android Target API Also add a 'CMAKE_ANDROID_API' variable to set the property default. --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/ANDROID_API.rst | 7 +++++++ Help/variable/CMAKE_ANDROID_API.rst | 5 +++++ Source/cmTarget.cxx | 1 + Source/cmVisualStudio10TargetGenerator.cxx | 6 ++++++ 6 files changed, 21 insertions(+) create mode 100644 Help/prop_tgt/ANDROID_API.rst create mode 100644 Help/variable/CMAKE_ANDROID_API.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index d17ea15..38bcd04 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_API /prop_tgt/ANDROID_GUI /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY_CONFIG /prop_tgt/ARCHIVE_OUTPUT_DIRECTORY diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 8017b43..3f92ec5 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_API /variable/CMAKE_ANDROID_GUI /variable/CMAKE_ARCHIVE_OUTPUT_DIRECTORY /variable/CMAKE_AUTOMOC_MOC_OPTIONS diff --git a/Help/prop_tgt/ANDROID_API.rst b/Help/prop_tgt/ANDROID_API.rst new file mode 100644 index 0000000..714ad58 --- /dev/null +++ b/Help/prop_tgt/ANDROID_API.rst @@ -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. diff --git a/Help/variable/CMAKE_ANDROID_API.rst b/Help/variable/CMAKE_ANDROID_API.rst new file mode 100644 index 0000000..c8264e0 --- /dev/null +++ b/Help/variable/CMAKE_ANDROID_API.rst @@ -0,0 +1,5 @@ +CMAKE_ANDROID_API +----------------- + +Default value for the :prop_tgt:`ANDROID_API` target property. +See that target property for additional information. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1e2f75c..85bf087 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -324,6 +324,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) // 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"); diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 15d0980..bfabb21 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -724,6 +724,12 @@ void cmVisualStudio10TargetGenerator ntv += toolset? toolset : "Default"; ntv += "\n"; this->WriteString(ntv.c_str(), 2); + if(const char* api = this->Target->GetProperty("ANDROID_API")) + { + this->WriteString("", 2); + (*this->BuildFileStream ) << + "android-" << cmVS10EscapeXML(api) << "\n"; + } } void cmVisualStudio10TargetGenerator::WriteCustomCommands() -- cgit v0.12