On Mon, Jun 26, 2017 at 3:32 PM, Brad King <brad.k...@kitware.com> wrote: > On 06/26/2017 11:58 AM, Robert Dailey wrote: >> Why does this only work in the toolchain file? > > 1. It needs to be set early. > > 2. It needs to propagate into try_compile projects. > > The toolchain file is sufficient for both. A cache entry is okay > for (1) but for (2) one would additionally need to set this: > > > https://cmake.org/cmake/help/v3.9/variable/CMAKE_TRY_COMPILE_PLATFORM_VARIABLES.html > > ...though that is really meant for toolchain files too. > > Note that toolchain files are meant to be local to the machine, not > distributed with source trees and full of introspection logic. The > (local) author of the toolchain file should know the NDK version and > choose whether to use `CMAKE_ANDROID_NDK_DEPRECATED_HEADERS`. > > Your project code could check the NDK version and error out if > the `CMAKE_ANDROID_NDK_DEPRECATED_HEADERS` is not correct.
Your idea of erroring out seems like the best alternative solution, although again I strongly feel this is something that should be automated. It makes the user's life easier. If we know it only works a certain way and have the necessary information to make that decision programmatically, then why not? Software is supposed to make our lives easier. Adding unnecessary manual steps doesn't really serve any benefit IMHO. Also at $DAYJOB, we all work on the same code base. Our product is tested and verified to work on a distinct set of configurations. Why would I ask each user to create their own toolchain file? Each time a change is needed, I'd have to email the whole team and ask them to make a specific change to their toolchain file. This is very unproductive. I can't say I agree with your philosophy. -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake-developers