diff --git a/CMakeLists.txt b/CMakeLists.txt index bc0d8638d5f6ba8636c02e949a5b3bb20e23d0ad..4b05ed5d7d9c2d95fd3a0c3204d79ef9f8fb0b6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1112,7 +1112,14 @@ endif() ## ############################################################################################################################ if ( WALBERLA_BUILD_WITH_LTO ) - set( CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE ) + cmake_policy( SET CMP0069 NEW ) + include( CheckIPOSupported ) + check_ipo_supported( RESULT LTO_SUPPORTED LANGUAGES CXX ) + if( LTO_SUPPORTED ) + set( CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE ) + else() + message( WARNING "Link-time optimization is not supported with this compiler" ) + endif() endif ( ) ############################################################################################################################