From 41b27f934b39f19900f6e35ecf31213ad66df5fe Mon Sep 17 00:00:00 2001 From: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> Date: Mon, 3 Apr 2023 11:28:37 +0100 Subject: [PATCH 1/2] Add documentation for tools.android.cmake_legacy_toolchain --- reference/commands/config.rst | 1 + reference/tools/cmake/cmaketoolchain.rst | 2 ++ 2 files changed, 3 insertions(+) diff --git a/reference/commands/config.rst b/reference/commands/config.rst index eb749418cfbc..9ca9e1a34fdf 100644 --- a/reference/commands/config.rst +++ b/reference/commands/config.rst @@ -209,6 +209,7 @@ Displays all the Conan built-in configurations. There are 2 groups: core:non_interactive: Disable interactive user input, raises error if input necessary core:required_conan_version: Raise if current version does not match the defined range. tools.android:ndk_path: Argument for the CMAKE_ANDROID_NDK + tools.android:cmake_legacy_toolchain: Value for ANDROID_USE_LEGACY_TOOLCHAIN_FILE in CMakeToolchain tools.apple:enable_arc: (boolean) Enable/Disable ARC Apple Clang flags tools.apple:enable_bitcode: (boolean) Enable/Disable Bitcode Apple Clang flags tools.apple:enable_visibility: (boolean) Enable/Disable Visibility Apple Clang flags diff --git a/reference/tools/cmake/cmaketoolchain.rst b/reference/tools/cmake/cmaketoolchain.rst index 38366703cb22..c2fa3572179a 100644 --- a/reference/tools/cmake/cmaketoolchain.rst +++ b/reference/tools/cmake/cmaketoolchain.rst @@ -451,6 +451,8 @@ CMakeToolchain is affected by these ``[conf]`` variables: - **tools.cmake.cmaketoolchain:toolchain_file** user toolchain file to replace the ``conan_toolchain.cmake`` one. - **tools.cmake.cmaketoolchain:user_toolchain** list of user toolchains to be included from the ``conan_toolchain.cmake`` file. - **tools.android:ndk_path** value for ``ANDROID_NDK_PATH``. +- **tools.android:cmake_legacy_toolchain**: value for ``ANDROID_USE_LEGACY_TOOLCHAIN_FILE``. It may be useful to set this to ``False`` if compiler flags + are defined via ``tools.build:cflags`` or ``tools.build:cxxflags`` to prevent Android's legacy CMake toolchain from overriding the values. - **tools.cmake.cmaketoolchain:system_name** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_NAME``. - **tools.cmake.cmaketoolchain:system_version** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_VERSION``. - **tools.cmake.cmaketoolchain:system_processor** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_PROCESSOR``. From 50f0813e1ad725c89ee01bde9e4b43b352d32b7e Mon Sep 17 00:00:00 2001 From: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> Date: Mon, 3 Apr 2023 12:22:30 +0100 Subject: [PATCH 2/2] add clarifications --- reference/commands/config.rst | 2 +- reference/tools/cmake/cmaketoolchain.rst | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/reference/commands/config.rst b/reference/commands/config.rst index 9ca9e1a34fdf..cc63322b748a 100644 --- a/reference/commands/config.rst +++ b/reference/commands/config.rst @@ -209,7 +209,7 @@ Displays all the Conan built-in configurations. There are 2 groups: core:non_interactive: Disable interactive user input, raises error if input necessary core:required_conan_version: Raise if current version does not match the defined range. tools.android:ndk_path: Argument for the CMAKE_ANDROID_NDK - tools.android:cmake_legacy_toolchain: Value for ANDROID_USE_LEGACY_TOOLCHAIN_FILE in CMakeToolchain + tools.android:cmake_legacy_toolchain: Boolean value for ANDROID_USE_LEGACY_TOOLCHAIN_FILE in CMakeToolchain. Not defined if not given a value. tools.apple:enable_arc: (boolean) Enable/Disable ARC Apple Clang flags tools.apple:enable_bitcode: (boolean) Enable/Disable Bitcode Apple Clang flags tools.apple:enable_visibility: (boolean) Enable/Disable Visibility Apple Clang flags diff --git a/reference/tools/cmake/cmaketoolchain.rst b/reference/tools/cmake/cmaketoolchain.rst index c2fa3572179a..513a0163181d 100644 --- a/reference/tools/cmake/cmaketoolchain.rst +++ b/reference/tools/cmake/cmaketoolchain.rst @@ -451,8 +451,10 @@ CMakeToolchain is affected by these ``[conf]`` variables: - **tools.cmake.cmaketoolchain:toolchain_file** user toolchain file to replace the ``conan_toolchain.cmake`` one. - **tools.cmake.cmaketoolchain:user_toolchain** list of user toolchains to be included from the ``conan_toolchain.cmake`` file. - **tools.android:ndk_path** value for ``ANDROID_NDK_PATH``. -- **tools.android:cmake_legacy_toolchain**: value for ``ANDROID_USE_LEGACY_TOOLCHAIN_FILE``. It may be useful to set this to ``False`` if compiler flags - are defined via ``tools.build:cflags`` or ``tools.build:cxxflags`` to prevent Android's legacy CMake toolchain from overriding the values. +- **tools.android:cmake_legacy_toolchain**: boolean value for ``ANDROID_USE_LEGACY_TOOLCHAIN_FILE``. It will only be defined in ``conan_toolchain.cmake`` if given a value. This is + taken into account by the CMake toolchain inside the Android NDK specified in the ``tools.android:ndk_path`` config, for versions ``r23c`` and above. + It may be useful to set this to ``False`` if compiler flags are defined via ``tools.build:cflags`` or ``tools.build:cxxflags`` to prevent Android's legacy CMake toolchain + from overriding the values. If setting this to ``False``, please ensure you are using CMake 3.21 or above. - **tools.cmake.cmaketoolchain:system_name** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_NAME``. - **tools.cmake.cmaketoolchain:system_version** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_VERSION``. - **tools.cmake.cmaketoolchain:system_processor** is not necessary in most cases and is only used to force-define ``CMAKE_SYSTEM_PROCESSOR``.