Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!) fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 64bf067..b5f1d55 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -945,7 +945,7 @@ endif()
# Platform-specific options and settings
if(ANDROID)
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
- set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES})
+ set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
# SDL_spinlock.c Needs to be compiled in ARM mode.
# There seems to be no better way currently to set the ARM mode.
@@ -2136,7 +2136,9 @@ if(SDL_SHARED)
set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
- if (NOT ANDROID)
+ if(ANDROID)
+ target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
+ else()
set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif()
if(IOS OR TVOS)
@@ -2182,7 +2184,9 @@ if(SDL_STATIC)
set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
target_include_directories(SDL2-static PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
- if (NOT ANDROID)
+ if(ANDROID)
+ target_include_directories(SDL2-static PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
+ else()
set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
endif()
if(IOS OR TVOS)