-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NDK cmake toolchain overrides CMAKE_FIND_ROOT_PATH #912
Comments
That won't do because we do need to make sure that the host system isn't being searched (which is why this changed, causing this new bug), but if the user is supposed to be able to override that then obviously the r19b approach isn't working either. I'll need to play with this a bit to see what we can do. Could you give me an example of how you use |
We use According to the cmake documentation this is what
I think Test caseA project that builds two libraries:
find_path(test_INCLUDE test.h)
if (test_INCLUDE)
message(STATUS "Found test include at: ${test_INCLUDE}")
else ()
message(FATAL_ERROR "Failed to locate test dependency.")
endif () Library B configured with: cmake . -DCMAKE_TOOLCHAIN_FILE=$(ANDROID_NDK)/build/cmake/android.toolchain.cmake \
-DANDROID_PLATFORM=$(ANDROID_API) \
-DANDROID_ABI=$(ANDROID_ABI) \
-DCMAKE_FIND_ROOT_PATH=$(PREFIX) \
-DCMAKE_INSTALL_PREFIX=$(PREFIX) I guess a full testcase might also make library B depend on some system library.. Possible solutionsBy default, The NDK might also set |
Yeah, given the explanation I think you're right. I'll make sure all our existing tests pass with that change and then see if I can work up a test case that makes use of |
https://android-review.googlesource.com/c/platform/ndk/+/907834 doesn't break any of our existing tests and does seem to fix the problem. For the moment I've only added a trivial test to make sure that we don't clobber user input, but it may be worth trying to build a more complete test at some point. Thanks for the report and suggestions on this! |
Many thanks ! |
Merged into r19c. |
If we set this option here we will clobber anything the user has provided on the command line. Despite the name, this is actually a list. All we need to ensure is that the variable is not empty, so appending to the list is sufficient to avoid the host's libraries. Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#912 Change-Id: I683a99c556e619e8fec86cbb89450407562e40b9 (cherry picked from commit fa4b2ee)
Upstream [changes][0]: * [Issue 912][1]: Prevent the CMake toolchain file from clobbering a user specified `CMAKE_FIND_ROOT_PATH`. * [Issue 920][2]: Fix clang wrapper scripts on Windows. [0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c [1]: android/ndk#912 [2]: android/ndk#920
Upstream [changes][0]: * [Issue 912][1]: Prevent the CMake toolchain file from clobbering a user specified `CMAKE_FIND_ROOT_PATH`. * [Issue 920][2]: Fix clang wrapper scripts on Windows. [0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c [1]: android/ndk#912 [2]: android/ndk#920
Upstream [changes][0]: * [Issue 912][1]: Prevent the CMake toolchain file from clobbering a user specified `CMAKE_FIND_ROOT_PATH`. * [Issue 920][2]: Fix clang wrapper scripts on Windows. [0]: https://github.com/android-ndk/ndk/wiki/Changelog-r19#r19c [1]: android/ndk#912 [2]: android/ndk#920
* Update ndk from branch 'ndk-release-r19' to 88cb7b0879e33f1f1801f58b6d7cc91bc8d1ae85 - Merge "Allow users to set their own CMAKE_FIND_ROOT_PATH." into ndk-release-r19 - Allow users to set their own CMAKE_FIND_ROOT_PATH. If we set this option here we will clobber anything the user has provided on the command line. Despite the name, this is actually a list. All we need to ensure is that the variable is not empty, so appending to the list is sufficient to avoid the host's libraries. Test: ./checkbuild.py && ./run_tests.py Bug: android/ndk#912 Change-Id: I683a99c556e619e8fec86cbb89450407562e40b9 (cherry picked from commit fa4b2ee3dbd1c8e5548c087682a9fea01636b15c)
Since NDKr19b (#890),
android.toolchain.cmake
overridesCMAKE_FIND_ROOT_PATH
to points to the NDK directory.This prevents projects building multiple libraries depending on each other to find other built libraries using
find_path
,find_library
etc.Indeed,
CMAKE_FIND_ROOT_PATH
is used to prefix every other cmake search path, sofind_library
would only be able to find libraries under the NDK path.It's possible to specify multiple root paths, so instead of overriding, the NDK might set itself as the first root path ?
or something similar.
The text was updated successfully, but these errors were encountered: