From df337192923b73a3706de15e22dbdc103fd018c1 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Tue, 29 Nov 2022 23:30:34 +0100
Subject: [PATCH] cmake: use target_* functions to set compile and link options
---
CMakeLists.txt | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6db233c..f4d8a10 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -199,17 +199,16 @@ else()
endif()
if(MINGW)
- set_target_properties(SDL2 PROPERTIES LINK_FLAGS "-nostdlib")
+ target_link_libraries(SDL2 PRIVATE -nostdlib)
target_link_libraries(SDL2 PRIVATE -static-libgcc -lgcc) # libgcc is needed for 32 bit (x86) builds
endif()
if(MSVC)
# Don't try to link with the default set of libraries.
- set(MSVC_FLAGS "/GS-")
+ target_compile_options(SDL2 PRIVATE /GS-)
if(SDL_CPU_X86) # don't emit SSE2 in x86 builds
- set(MSVC_FLAGS "${MSVC_FLAGS} /arch:SSE")
+ target_compile_options(SDL2 PRIVATE /arch:SSE)
endif()
- set_target_properties(SDL2 PROPERTIES COMPILE_FLAGS ${MSVC_FLAGS})
- set_target_properties(SDL2 PROPERTIES LINK_FLAGS "/NODEFAULTLIB")
+ target_link_libraries(SDL2 PRIVATE /NODEFAULTLIB)
# Make sure /RTC1 is disabled: (from SDL2 CMake)
foreach(flag_var
CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE