cmake: avoid modifying CMAKE_C_FLAGS
parent
8fc445c730
commit
053c37583c
|
@ -201,7 +201,6 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
|
||||||
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
||||||
elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
|
elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
|
||||||
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
||||||
#set(CMAKE_C_FLAGS "/ZI /WX- /
|
|
||||||
else()
|
else()
|
||||||
set(SDL_ASSEMBLY_DEFAULT FALSE)
|
set(SDL_ASSEMBLY_DEFAULT FALSE)
|
||||||
endif()
|
endif()
|
||||||
|
@ -641,8 +640,7 @@ if(USE_GCC OR USE_CLANG)
|
||||||
cmake_push_check_state()
|
cmake_push_check_state()
|
||||||
check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4)
|
check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4)
|
||||||
if(HAVE_GDWARF_4)
|
if(HAVE_GDWARF_4)
|
||||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4")
|
target_compile_options(sdl-global-options INTERFACE "-gdwarf-4")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-4")
|
|
||||||
endif()
|
endif()
|
||||||
cmake_pop_check_state()
|
cmake_pop_check_state()
|
||||||
endif()
|
endif()
|
||||||
|
@ -2799,26 +2797,16 @@ if(SDL_WERROR)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
check_c_compiler_flag(/WX HAVE_WX)
|
check_c_compiler_flag(/WX HAVE_WX)
|
||||||
if(HAVE_WX)
|
if(HAVE_WX)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
target_compile_options(sdl-global-options INTERFACE "/WX")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
|
||||||
endif()
|
endif()
|
||||||
elseif(USE_GCC OR USE_CLANG)
|
elseif(USE_GCC OR USE_CLANG)
|
||||||
check_c_compiler_flag(-Werror HAVE_WERROR)
|
check_c_compiler_flag(-Werror HAVE_WERROR)
|
||||||
if(HAVE_WERROR)
|
if(HAVE_WERROR)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
target_compile_options(sdl-global-options INTERFACE "-Werror")
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
|
||||||
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
|
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Append the -MMD -MT flags
|
|
||||||
# if(DEPENDENCY_TRACKING)
|
|
||||||
# if(COMPILER_IS_GNUCC)
|
|
||||||
# set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -MMD -MT \$@")
|
|
||||||
# endif()
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
# config variables may contain generator expression, so we need to generate SDL_build_config.h in 2 steps:
|
# config variables may contain generator expression, so we need to generate SDL_build_config.h in 2 steps:
|
||||||
# 1. replace all `#cmakedefine`'s and `@abc@`
|
# 1. replace all `#cmakedefine`'s and `@abc@`
|
||||||
configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
|
configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
|
||||||
|
@ -2971,7 +2959,7 @@ macro(asan_check_add_debug_flag2 ASAN_FLAG)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
# enable AddressSanitizer if supported
|
# enable AddressSanitizer if supported
|
||||||
if (SDL_ASAN)
|
if(SDL_ASAN)
|
||||||
asan_check_add_debug_flag2("address")
|
asan_check_add_debug_flag2("address")
|
||||||
asan_check_add_debug_flag("bool")
|
asan_check_add_debug_flag("bool")
|
||||||
asan_check_add_debug_flag("bounds")
|
asan_check_add_debug_flag("bounds")
|
||||||
|
@ -3048,13 +3036,13 @@ message(STATUS "")
|
||||||
message(STATUS "Options:")
|
message(STATUS "Options:")
|
||||||
list(SORT ALLOPTIONS)
|
list(SORT ALLOPTIONS)
|
||||||
message_dictlist(ALLOPTIONS)
|
message_dictlist(ALLOPTIONS)
|
||||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
|
||||||
message(STATUS "")
|
|
||||||
message(STATUS " CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
|
||||||
message(STATUS " CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
|
||||||
endif()
|
|
||||||
message(STATUS "")
|
message(STATUS "")
|
||||||
message(STATUS " CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
message(STATUS " CMAKE_C_FLAGS: ${CMAKE_C_FLAGS}")
|
||||||
|
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
|
||||||
|
message(STATUS " CMAKE_C_FLAGS_DEBUG: ${CMAKE_C_FLAGS_DEBUG}")
|
||||||
|
message(STATUS " CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
|
||||||
|
message(STATUS "")
|
||||||
|
endif()
|
||||||
message(STATUS " EXTRA DEFS: ${INFO_DEFS}")
|
message(STATUS " EXTRA DEFS: ${INFO_DEFS}")
|
||||||
message(STATUS " EXTRA CFLAGS: ${INFO_CFLAGS} ${INFO_CHECKS}")
|
message(STATUS " EXTRA CFLAGS: ${INFO_CFLAGS} ${INFO_CHECKS}")
|
||||||
message(STATUS " EXTRA INCDIRS: ${INFO_INCDIRS}")
|
message(STATUS " EXTRA INCDIRS: ${INFO_INCDIRS}")
|
||||||
|
|
|
@ -1033,7 +1033,7 @@ macro(CheckHIDAPI)
|
||||||
check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS})
|
check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS})
|
||||||
if(HAVE_LIBUSB_H)
|
if(HAVE_LIBUSB_H)
|
||||||
set(HAVE_LIBUSB TRUE)
|
set(HAVE_LIBUSB TRUE)
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${PKG_LIBUSB_CFLAGS}")
|
target_compile_options(sdl-build-options INTERFACE ${PKG_LIBUSB_CFLAGS})
|
||||||
if(HIDAPI_ONLY_LIBUSB)
|
if(HIDAPI_ONLY_LIBUSB)
|
||||||
list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES})
|
list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES})
|
||||||
else()
|
else()
|
||||||
|
@ -1108,8 +1108,7 @@ macro(CheckRPI)
|
||||||
file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c)
|
file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c)
|
||||||
list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES})
|
list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES})
|
||||||
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
|
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
|
||||||
# !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right?
|
target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS})
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
|
|
||||||
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
|
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue