diff --git a/CMakeLists.txt b/CMakeLists.txt index 048dd44a..e3f9cb63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ endif() if(ENABLE_LTO) add_compile_options(-O3 -flto) + add_link_options(-flto) set(CMAKE_AR "gcc-ar") set(CMAKE_C_ARCHIVE_CREATE " qcs ") set(CMAKE_C_ARCHIVE_FINISH true) diff --git a/src/libui_sdl/libui/unix/CMakeLists.txt b/src/libui_sdl/libui/unix/CMakeLists.txt index c69081ee..39f6c0a0 100644 --- a/src/libui_sdl/libui/unix/CMakeLists.txt +++ b/src/libui_sdl/libui/unix/CMakeLists.txt @@ -65,7 +65,7 @@ macro(_handle_static) OUTPUT ${_oname} DEPENDS ${_LIBUINAME} COMMAND - ld -r --whole-archive ${_aname} -o ${_oname} + ${CMAKE_LINKER} -r --whole-archive ${_aname} -o ${_oname} COMMAND objcopy --localize-hidden ${_oname} COMMENT "Removing hidden symbols") diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 9dea9f17..80b86651 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #ifndef __WIN32__ #include