diff --git a/r5dev/cmake/Options.cmake b/r5dev/cmake/Options.cmake index 5d9be9de..3570c20f 100644 --- a/r5dev/cmake/Options.cmake +++ b/r5dev/cmake/Options.cmake @@ -21,6 +21,7 @@ macro( apply_project_settings ) # Some thirdparty code have Warnings as Errors disabled; this option won't override those. option( GLOBAL_WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON ) + option( ENABLE_LTCG "Enable link-time code generation (significantly increases compile times)" OFF ) set( GAMEDLL_OPTION "GAMEDLL_S3" CACHE STRING "Game DLL version" ) set_property( CACHE GAMEDLL_OPTION PROPERTY STRINGS @@ -60,6 +61,13 @@ macro( apply_project_settings ) $<$,$>:/EHsc> ) + if( ${ENABLE_LTCG} ) + add_compile_options( + $<$,$>:/GL> + $<$,$>:/GL> + ) + endif() + set( CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /OPT:REF