File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -555,15 +555,22 @@ function(_add_target_variant_link_flags)
555
555
list (APPEND link_libraries "dl" "log" )
556
556
# We need to add the math library, which is linked implicitly by libc++
557
557
list (APPEND result "-lm" )
558
- if (NOT CMAKE_HOST_SYSTEM MATCHES Windows )
558
+ if (NOT CMAKE_HOST_SYSTEM MATCHES Windows AND NOT " ${SWIFT_ANDROID_NDK_PATH} " STREQUAL "" )
559
559
# The Android resource dir is specified from build.ps1 on windows.
560
- if (NOT "${SWIFT_ANDROID_NDK_PATH} " STREQUAL "" )
561
- if ("${SWIFT_ANDROID_NDK_PATH} " MATCHES "r26|r27" )
560
+ if (EXISTS "${SWIFT_ANDROID_NDK_PATH} /source.properties" )
561
+ file (READ "${SWIFT_ANDROID_NDK_PATH} /source.properties" NDK_VERSION )
562
+ if (NOT NDK_VERSION MATCHES "Pkg\\ .Revision = ([0-9\\ .]+)" )
563
+ message (FATAL_ERROR "Could not find NDK version in source.properties: ${NDK_VERSION} " )
564
+ endif ()
565
+
566
+ if ("${CMAKE_MATCH_1} " VERSION_GREATER_EQUAL "26" )
562
567
file (GLOB RESOURCE_DIR ${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib/clang/* )
563
568
else ()
564
569
file (GLOB RESOURCE_DIR ${SWIFT_SDK_ANDROID_ARCH_${LFLAGS_ARCH}_PATH}/../lib64/clang/* )
565
570
endif ()
566
571
list (APPEND result "-resource-dir=${RESOURCE_DIR} " )
572
+ else ()
573
+ message (FATAL_ERROR "Could not detect NDK version: ${SWIFT_ANDROID_NDK_PATH} /source.properties not found" )
567
574
endif ()
568
575
endif ()
569
576
You can’t perform that action at this time.
0 commit comments