From 331c845be25cbc7a088e6b54549569bffc363f8b Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Tue, 3 May 2022 19:25:37 +0200 Subject: [PATCH] fix LTO and a bad include --- CMakeLists.txt | 17 +++++++++++------ src/CMakeLists.txt | 1 - 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 504948b6..10302391 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,12 @@ cmake_minimum_required(VERSION 3.15) -cmake_policy(VERSION 3.13) +cmake_policy(VERSION 3.15) if (POLICY CMP0076) cmake_policy(SET CMP0076 NEW) endif() +set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) + set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) project(melonDS C CXX) @@ -66,12 +68,15 @@ cmake_dependent_option(ENABLE_JIT_PROFILING "Enable JIT profiling with VTune" OF option(ENABLE_OGLRENDERER "Enable OpenGL renderer" ON) check_ipo_supported(RESULT IPO_SUPPORTED) -cmake_dependent_option(ENABLE_LTO "Enable link-time optimizations" "Release" "IPO_SUPPORTED" "OFF") +cmake_dependent_option(ENABLE_LTO_RELEASE "Enable link-time optimizations for release builds" ON "IPO_SUPPORTED" OFF) +cmake_dependent_option(ENABLE_LTO "Enable link-time optimizations" OFF "IPO_SUPPORTED" OFF) -if (ENABLE_LTO STREQUAL "Release") - set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) -elseif(ENABLE_LTO STREQUAL "ON") - set_property(GLOBAL PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE) +if (ENABLE_LTO_RELEASE) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) +endif() + +if (ENABLE_LTO) + set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) endif() set(CMAKE_C_FLAGS_DEBUG "-Og") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6e765898..cdb05871 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -119,7 +119,6 @@ if (ENABLE_OGLRENDERER) pkg_check_modules(Epoxy REQUIRED IMPORTED_TARGET epoxy) fix_interface_includes(PkgConfig::Epoxy) - target_include_directories(core PRIVATE PkgConfig::Epoxy) target_link_libraries(core PUBLIC PkgConfig::Epoxy) target_compile_definitions(core PUBLIC OGLRENDERER_ENABLED)