Fix discovery rule for perl and go for Android
We don't use find_package/find_program on android to find go/perl
because the android toolchain reconfigure the $PATH. The pervious
way of solving this was to let ninja look for go/perl on the $PATH
but this approach prevented us from specifying explicit go/perl
executables what is needed for hermetic build using prebuilts. This
CL changes the Android specific discovery rule to only set
GO_EXECUTABLE and PERL_EXECUTABLE if they are not specified on the
command line or inside the toolchain file.
Change-Id: Ib6ef69707749073f2b79244ebb301502b2a5a34a
Reviewed-on: https://boringssl-review.googlesource.com/8000
Reviewed-by: David Benjamin <davidben@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f36cd38..ec82e1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,8 +15,12 @@
if(ANDROID)
# Android-NDK CMake files reconfigure the path and so Go and Perl won't be
# found. However, ninja will still find them in $PATH if we just name them.
- set(PERL_EXECUTABLE "perl")
- set(GO_EXECUTABLE "go")
+ if(NOT PERL_EXECUTABLE)
+ set(PERL_EXECUTABLE "perl")
+ endif()
+ if(NOT GO_EXECUTABLE)
+ set(GO_EXECUTABLE "go")
+ endif()
else()
find_package(Perl REQUIRED)
find_program(GO_EXECUTABLE go)