Skip to content

Commit c5cdc6a

Browse files
authored
Use -flto=auto for LTO builds using GCC (#570)
GCC generates log warnings if you use -flto without a core count parameter, so modify the build to specify an auto core count.
1 parent 8837f91 commit c5cdc6a

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Source/CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,14 @@
1717

1818
# Overwrite the LTO flags to force fat LTO; worth 3-4% performance
1919
# See https://gitlab.kitware.com/cmake/cmake/-/issues/16808
20-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" AND ${ASTCENC_CLI})
20+
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND ${ASTCENC_CLI})
2121
set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto")
2222
endif()
2323

24+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND ${ASTCENC_CLI})
25+
set(CMAKE_CXX_COMPILE_OPTIONS_IPO "-flto=auto")
26+
endif()
27+
2428
if(${ASTCENC_DECOMPRESSOR})
2529
set(ASTCENC_CODEC dec)
2630
else()

0 commit comments

Comments
 (0)