Cannot use IPO for FujitsuClang
Interprocedural optimizations (IPO) cannot be used for the Fujitsu compiler on Clang mode, despite the fact the flag exists (-flto
) for both C and C++ compilers.
Minimal working example:
cmake_minimum_required(VERSION 3.20)
project(TestIPO VERSION 0.0.0 LANGUAGES C;CXX)
include(CheckIPOSupported)
check_ipo_supported()
I looked for details and found that when trying to build test files, the archiver executable is not provided:
"" cr libfoo.a CMakeFiles/foo.dir/foo.c.o
In Modules/Compiler/Clang.cmake
, the archiver command for IPO is defined at line 94, from the CMAKE_${lang}_COMPILER_AR
variable at line 89, which seems to be empty in my case. I tried to specify it in the CMakeLists.txt
file or in Modules/Compiler/FujitsuClang.cmake
, but it did not help.
Edited by Brad King