From ba988419445f268c9c6036b3d85d22cf097c2e4a Mon Sep 17 00:00:00 2001 From: a dinosaur Date: Tue, 22 Nov 2022 08:01:41 +1100 Subject: [PATCH] Fix windows build --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c499665..d40c4a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,11 @@ set(TARGET padlab) option(USE_OPENGL "Use legacy OpenGL for drawing" ON) set(CMAKE_C_STANDARD 99) +if (C_COMPILER_ID IN_LIST "GNU;Clang;AppleClang") + set(GNU) +elseif (MSVC) + string(REPLACE "/W3" "/W4" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +endif() find_package(SDL2 REQUIRED) if (USE_OPENGL) @@ -19,8 +24,11 @@ set(SOURCES add_executable(${TARGET} ${SOURCES}) target_link_libraries(${TARGET} - SDL2::SDL2 $<$:OpenGL::GL> m) + $<$:SDL2::SDL2main> + SDL2::SDL2 + $<$:OpenGL::GL> + $<$:m>) target_compile_options(${TARGET} PRIVATE - -Wall -Wextra -pedantic -Wno-unused-parameter) + $<$:-Wall -Wextra -pedantic -Wno-unused-parameter>) target_compile_definitions(${TARGET} PRIVATE $<$:USE_OPENGL>)