Skip to content

Commit de41b19

Browse files
committed
Fix ndk path detect
1 parent 77c175e commit de41b19

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

library/src/main/jni/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ option(CGE_USE_VIDEO_MODULE "boolean option to enable video module" OFF)
88

99
if(NOT DEFINED ANDROID_GRADLE OR NOT ANDROID_GRADLE)
1010
if(NOT DEFINED ENV{NDK})
11-
execute_process(COMMAND which ndk-build OUTPUT_VARIABLE CGE_NDK_DIR)
11+
execute_process(COMMAND which ndk-build OUTPUT_VARIABLE CGE_NDK_BUILD_PATH OUTPUT_STRIP_TRAILING_WHITESPACE)
1212

13-
if("${CGE_NDK_DIR}" STREQUAL "")
13+
if("${CGE_NDK_BUILD_PATH}" STREQUAL "")
1414
message(FATAL_ERROR "You should define the NDK variable!")
1515
else()
16-
execute_process(COMMAND export NDK=$(dirname `which ndk-build`))
16+
get_filename_component(CGE_NDK_DIR "${CGE_NDK_BUILD_PATH}" DIRECTORY)
17+
set(ENV{NDK} "${CGE_NDK_DIR}")
18+
message(STATUS "Auto-detected NDK path: ${CGE_NDK_DIR}")
1719
endif()
1820
endif()
1921

0 commit comments

Comments
 (0)