1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Warn about LTO and adds an option to remove LTO flags

This commit is contained in:
RipleyTom 2022-05-15 18:37:53 +02:00 committed by Megamouse
parent b0e5db0eb0
commit 8c01612851

View File

@ -123,6 +123,20 @@ add_subdirectory(3rdparty)
unset(CMAKE_CXX_FLAGS) unset(CMAKE_CXX_FLAGS)
unset(CMAKE_C_FLAGS) unset(CMAKE_C_FLAGS)
if (DISABLE_LTO)
if (CMAKE_C_FLAGS)
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
endif()
if (CMAKE_CXX_FLAGS)
string(REGEX REPLACE "-flto[^ ]*" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()
endif()
string(FIND "${CMAKE_C_FLAGS} ${CMAKE_CXX_FLAGS}" "-flto" FOUND_LTO)
if (NOT FOUND_LTO EQUAL -1)
message(FATAL_ERROR "Rpcs3 doesn't support building with LTO, use -DDISABLE_LTO=TRUE to force-disable it")
endif()
if(NOT WIN32) if(NOT WIN32)
add_compile_options(-pthread) add_compile_options(-pthread)
endif() endif()