Skip to content

Commit

Permalink
CMake: enable clang LTO-friendly flags under `CMAKE_INTERPROCEDURAL_O…
Browse files Browse the repository at this point in the history
…PTIMIZATION`, not `RAWSPEED_ENABLE_LTO`
  • Loading branch information
LebedevRI committed Apr 30, 2024
1 parent f22fd3c commit e30968a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmake/compiler-flags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,17 @@ SET(CMAKE_MODULE_LINKER_FLAGS
"${CMAKE_MODULE_LINKER_FLAGS} ${linkerflags}"
)

if(CMAKE_INTERPROCEDURAL_OPTIMIZATION)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
set(LIST -fforce-emit-vtables -fwhole-program-vtables -fstrict-vtable-pointers)
add_compile_options("$<$<COMPILE_LANGUAGE:C,CXX>:${LIST}>")
endif()
endif()

if(RAWSPEED_ENABLE_LTO)
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
include(llvm-toolchain)
set(lto_compile "-flto=thin -fforce-emit-vtables -fwhole-program-vtables -fstrict-vtable-pointers")
set(lto_compile "-flto=thin")
set(lto_link "-flto=thin -fuse-ld=\"${LLVMLLD_EXECUTABLE}\" ${LLVMLLD_INCREMENTAL_LDFLAGS}")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
include(gcc-toolchain)
Expand Down

0 comments on commit e30968a

Please sign in to comment.