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.

-Brad

-- 

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

Reply via email to