From 8d75b84ba6e5d39e4fe153b604932a1be69c8129 Mon Sep 17 00:00:00 2001 From: Matthias Volk Date: Mon, 20 Jul 2020 11:30:08 +0200 Subject: [PATCH] Throw error when using ThinLTO and GCC --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a88333f6..cbab845cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,13 +277,17 @@ elseif (STORM_COMPILER_GCC) endif () if (STORM_USE_THIN_LTO) - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin") - message(STATUS "Storm - Enabling link-time optimizations using ThinLTO.") + if (STORM_COMPILER_CLANG OR STORM_COMPILER_APPLECLANG) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto=thin") + message(STATUS "Storm - Enabling link-time optimizations using ThinLTO.") + else() + message(FATAL_ERROR "Storm - ThinLTO only supported for Clang. Use regular LTO instead.") + endif() elseif (STORM_USE_LTO) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto") # Fix for problems that occurred when using LTO on gcc. This should be removed when it - # is not needed anymore as it makes the the already long link-step potentially longer. + # is not needed anymore as it makes the already long link-step potentially longer. if (STORM_COMPILER_GCC) set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -flto-partition=none") endif()