enable static linking if under release mode

This commit is contained in:
Love 2024-01-29 16:31:51 +01:00
parent a4e5e14428
commit cdbcc0330d

View File

@ -54,6 +54,11 @@ target_link_libraries(Pong ${SDL2_LIBRARIES} ${SDL2_GFX_LIBRARY} ${SDL2_TTF_LIBR
# Set compiler optimization flags
if (ENABLE_OPTIMIZATIONS)
message(STATUS "Optimizations are enabled")
set_target_properties(Pong PROPERTIES LINK_SEARCH_START_STATIC 1)
set_target_properties(Pong PROPERTIES LINK_SEARCH_END_STATIC 1)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
if (MSVC)
target_compile_options(Pong PRIVATE /O2)
else ()