Merge pull request #621 from nadiaholmquist/fix/lto-ldflag

Add -flto as link flag, also fix missing <string> include in main.cpp causing the build to fail with GCC10
This commit is contained in:
Arisotura 2020-05-10 23:11:24 +02:00 committed by GitHub
commit bc9c989f61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 1 deletions

View File

@ -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 "<CMAKE_AR> qcs <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_FINISH true)

View File

@ -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")

View File

@ -20,6 +20,7 @@
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <string>
#ifndef __WIN32__
#include <glib.h>