cmake: avoid modifying CMAKE_C_FLAGS
parent
8fc445c730
commit
053c37583c
|
@ -201,7 +201,6 @@ elseif(CMAKE_COMPILER_IS_GNUCC)
|
|||
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
||||
elseif(MSVC_VERSION GREATER 1400) # VisualStudio 8.0+
|
||||
set(SDL_ASSEMBLY_DEFAULT TRUE)
|
||||
#set(CMAKE_C_FLAGS "/ZI /WX- /
|
||||
else()
|
||||
set(SDL_ASSEMBLY_DEFAULT FALSE)
|
||||
endif()
|
||||
|
@ -641,8 +640,7 @@ if(USE_GCC OR USE_CLANG)
|
|||
cmake_push_check_state()
|
||||
check_c_compiler_flag("-gdwarf-4" HAVE_GDWARF_4)
|
||||
if(HAVE_GDWARF_4)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -gdwarf-4")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -gdwarf-4")
|
||||
target_compile_options(sdl-global-options INTERFACE "-gdwarf-4")
|
||||
endif()
|
||||
cmake_pop_check_state()
|
||||
endif()
|
||||
|
@ -2799,26 +2797,16 @@ if(SDL_WERROR)
|
|||
if(MSVC)
|
||||
check_c_compiler_flag(/WX HAVE_WX)
|
||||
if(HAVE_WX)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /WX")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
|
||||
target_compile_options(sdl-global-options INTERFACE "/WX")
|
||||
endif()
|
||||
elseif(USE_GCC OR USE_CLANG)
|
||||
check_c_compiler_flag(-Werror HAVE_WERROR)
|
||||
if(HAVE_WERROR)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||
set(CMAKE_OBJC_FLAGS "${CMAKE_OBJC_FLAGS} -Werror")
|
||||
target_compile_options(sdl-global-options INTERFACE "-Werror")
|
||||
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:
|
||||
# 1. replace all `#cmakedefine`'s and `@abc@`
|
||||
configure_file("${SDL3_SOURCE_DIR}/include/build_config/SDL_build_config.h.cmake"
|
||||
|
@ -3048,13 +3036,13 @@ message(STATUS "")
|
|||
message(STATUS "Options:")
|
||||
list(SORT 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 " 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 CFLAGS: ${INFO_CFLAGS} ${INFO_CHECKS}")
|
||||
message(STATUS " EXTRA INCDIRS: ${INFO_INCDIRS}")
|
||||
|
|
|
@ -1033,7 +1033,7 @@ macro(CheckHIDAPI)
|
|||
check_include_file(libusb.h HAVE_LIBUSB_H ${PKG_LIBUSB_CFLAGS})
|
||||
if(HAVE_LIBUSB_H)
|
||||
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)
|
||||
list(APPEND EXTRA_LIBS ${PKG_LIBUSB_LIBRARIES})
|
||||
else()
|
||||
|
@ -1108,8 +1108,7 @@ macro(CheckRPI)
|
|||
file(GLOB VIDEO_RPI_SOURCES ${SDL3_SOURCE_DIR}/src/video/raspberry/*.c)
|
||||
list(APPEND SOURCE_FILES ${VIDEO_RPI_SOURCES})
|
||||
list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES})
|
||||
# !!! FIXME: shouldn't be using CMAKE_C_FLAGS, right?
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}")
|
||||
target_compile_options(sdl-build-options INTERFACE ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS})
|
||||
list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS})
|
||||
endif()
|
||||
endif()
|
||||
|
|
Loading…
Reference in New Issue