Skip to content

Commit

Permalink
Interconnect: add /OPT:NOICF for clang-cl as well.
Browse files Browse the repository at this point in the history
It uses the MSVC linker by default, thus the same optimization is used
by default. The breakage happens only in a Release build.
  • Loading branch information
mosra committed Sep 30, 2023
1 parent 51d73a7 commit f76ac49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/corrade-changelog.dox
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ namespace Corrade {
crash on Emscripten 3.1.27+, which reduced the default stack size from
5 MB to 64 kB.
- New @cpp #pragma ACME forget @ce option in the @ref acme utility
- `/OPT:NOICF` is now added for the @ref Interconnect library for clang-cl
as well (see [mosra/corrade#178](https://github.com/mosra/corrade/issues/178))

@subsection corrade-changelog-latest-bugfixes Bug fixes

Expand Down
5 changes: 3 additions & 2 deletions modules/FindCorrade.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,9 @@ foreach(_component ${Corrade_FIND_COMPONENTS})
# Interconnect library
if(_component STREQUAL Interconnect)
# Disable /OPT:ICF on MSVC, which merges functions with identical
# contents and thus breaks signal comparison
if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# contents and thus breaks signal comparison. Same case is for
# clang-cl which uses the MSVC linker by default.
if(CORRADE_TARGET_WINDOWS AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
if(CMAKE_VERSION VERSION_LESS 3.13)
set_property(TARGET Corrade::${_component} PROPERTY
INTERFACE_LINK_LIBRARIES "-OPT:NOICF,REF")
Expand Down
5 changes: 3 additions & 2 deletions src/Corrade/Interconnect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ endif()

target_link_libraries(CorradeInterconnect PUBLIC CorradeUtility)
# Disable /OPT:ICF on MSVC, which merges functions with identical contents and
# thus breaks signal comparison
if(CORRADE_TARGET_WINDOWS AND CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# thus breaks signal comparison. Same case is for clang-cl which uses the MSVC
# linker by default.
if(CORRADE_TARGET_WINDOWS AND (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" OR CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC"))
if(CMAKE_VERSION VERSION_LESS 3.13)
target_link_libraries(CorradeInterconnect INTERFACE "-OPT:NOICF,REF")
else()
Expand Down

0 comments on commit f76ac49

Please sign in to comment.