Skip to content

Commit

Permalink
Build using LTO if compiler supports it (requires Cmake 3.9)
Browse files Browse the repository at this point in the history
  • Loading branch information
eklitzke committed Jun 10, 2020
1 parent c5acf62 commit 39ec154
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.8)
cmake_minimum_required(VERSION 3.9)
project(ccls LANGUAGES CXX)

option(USE_SYSTEM_RAPIDJSON "Use system RapidJSON instead of the git submodule if exists" ON)
Expand Down Expand Up @@ -30,6 +30,13 @@ set_property(TARGET ccls PROPERTY CXX_STANDARD 17)
set_property(TARGET ccls PROPERTY CXX_STANDARD_REQUIRED ON)
set_property(TARGET ccls PROPERTY CXX_EXTENSIONS OFF)

# Build using LTO if the compiler supports it
include(CheckIPOSupported)
check_ipo_supported(RESULT ipo OUTPUT error)
if (ipo)
set_property(TARGET ccls PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()

# CMake sets MSVC for both MSVC and Clang(Windows)
if(MSVC)
# Common MSVC/Clang(Windows) options
Expand Down

0 comments on commit 39ec154

Please sign in to comment.