From 04fd22f12c52d5ce0b34827c382076ade06f7ad5 Mon Sep 17 00:00:00 2001 From: Username404-59 Date: Mon, 1 Mar 2021 20:19:16 +0100 Subject: [PATCH] Use optimization flags on CLang too. --- CMakeLists.txt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dd8aec0..2f09b52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,13 +7,16 @@ set(CMAKE_CXX_FLAGS "-Wall -pthread") set(CMAKE_CXX_FLAGS_RELEASE "-Os") if((${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) OR (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang)) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector -fstack-clash-protection") + set(CMAKE_CXX_FLAGS "-flto ${CMAKE_CXX_FLAGS} -fstack-protector -fstack-clash-protection") endif() if (${CMAKE_CXX_COMPILER_ID} STREQUAL GNU) set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fira-loop-pressure -ftree-loop-distribution -floop-interchange -ftree-vectorize -fipa-pta -s") - set(CMAKE_CXX_FLAGS "-flto -fno-use-linker-plugin -fwhole-program ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "-fno-use-linker-plugin -fwhole-program ${CMAKE_CXX_FLAGS}") +elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -ftree-vectorize") + set(CMAKE_CXX_FLAGS "-fwhole-program-vtables ${CMAKE_CXX_FLAGS}") endif() if(MINGW OR MSVC)