Skip to content

Commit

Permalink
Add compile option -fno-strict-aliasing for all compilers but MSVC. (K…
Browse files Browse the repository at this point in the history
  • Loading branch information
asuessenbach authored Nov 6, 2024
1 parent 96887d8 commit 8e87ebc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ endif()
# globally add VKB_DEBUG for the debug build
add_compile_definitions($<$<CONFIG:DEBUG>:VKB_DEBUG>)

# globally set -fno-strict-aliasing, needed due to using reinterpret_cast
if (!MSVC)
add_compile_options(-fno_strict_aliasing)
endif()

if(MSVC AND (DEFINED CMAKE_C_COMPILER_LAUNCHER))
message(DEBUG "Setting MSVC flags to /Z7 for ccache compatibility. Current flags: ${CMAKE_CXX_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
Expand Down

0 comments on commit 8e87ebc

Please sign in to comment.