mirror of https://github.com/libsdl-org/SDL
Fix CMake CMAKE_REQUIRED_FLAGS handling to preserve existing CMake flags required by Emscripten toolchain.
This commit is contained in:
parent
b54eb82c67
commit
264e996e0f
|
@ -205,7 +205,7 @@ set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
||||||
if(CYGWIN)
|
if(CYGWIN)
|
||||||
# We build SDL on cygwin without the UNIX emulation layer
|
# We build SDL on cygwin without the UNIX emulation layer
|
||||||
include_directories("-I/usr/include/mingw")
|
include_directories("-I/usr/include/mingw")
|
||||||
set(CMAKE_REQUIRED_FLAGS "-mno-cygwin")
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -mno-cygwin")
|
||||||
check_c_source_compiles("int main(int argc, char **argv) {}"
|
check_c_source_compiles("int main(int argc, char **argv) {}"
|
||||||
HAVE_GCC_NO_CYGWIN)
|
HAVE_GCC_NO_CYGWIN)
|
||||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||||
|
|
|
@ -766,7 +766,8 @@ macro(CheckPTHREAD)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Run some tests
|
# Run some tests
|
||||||
set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
|
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS}")
|
||||||
if(CMAKE_CROSSCOMPILING)
|
if(CMAKE_CROSSCOMPILING)
|
||||||
set(HAVE_PTHREADS 1)
|
set(HAVE_PTHREADS 1)
|
||||||
else()
|
else()
|
||||||
|
@ -828,7 +829,7 @@ macro(CheckPTHREAD)
|
||||||
int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
|
int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H)
|
||||||
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
|
check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP)
|
||||||
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
|
check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP)
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||||
|
|
||||||
set(SOURCE_FILES ${SOURCE_FILES}
|
set(SOURCE_FILES ${SOURCE_FILES}
|
||||||
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
|
${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c
|
||||||
|
@ -882,7 +883,8 @@ macro(CheckUSBHID)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${USB_CFLAGS}")
|
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${USB_CFLAGS}")
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}")
|
set(CMAKE_REQUIRED_LIBRARIES "${USB_LIBS}")
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -983,7 +985,7 @@ macro(CheckUSBHID)
|
||||||
set(HAVE_SDL_JOYSTICK TRUE)
|
set(HAVE_SDL_JOYSTICK TRUE)
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||||
endif()
|
endif()
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
@ -997,12 +999,13 @@ macro(CheckRPI)
|
||||||
listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
|
listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I")
|
||||||
listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
|
listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L")
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
|
set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
|
||||||
|
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
|
||||||
set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
|
set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}")
|
||||||
check_c_source_compiles("
|
check_c_source_compiles("
|
||||||
#include <bcm_host.h>
|
#include <bcm_host.h>
|
||||||
int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
|
int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
|
||||||
set(CMAKE_REQUIRED_FLAGS)
|
set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||||
set(CMAKE_REQUIRED_LIBRARIES)
|
set(CMAKE_REQUIRED_LIBRARIES)
|
||||||
|
|
||||||
if(SDL_VIDEO AND HAVE_VIDEO_RPI)
|
if(SDL_VIDEO AND HAVE_VIDEO_RPI)
|
||||||
|
|
Loading…
Reference in New Issue