Skip to content

Commit 936b2e1

Browse files
committed
CMakeLists.txt: Set -fno-strict-aliasing for basisu
Several basisu headers demand doing this ("Important: If compiling with gcc, be sure strict aliasing is disabled: -fno-strict-aliasing") and their own CMakeLists.txt (that's not used here) also sets it.
1 parent 76a58c9 commit 936b2e1

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,26 @@ else()
945945
message(FATAL_ERROR "${CMAKE_CXX_COMPILER_ID} not yet supported.")
946946
endif()
947947

948+
if(NOT MSVC)
949+
# Basis Universal requires strict aliasing to be disabled for GCC and Clang
950+
get_source_file_property(cur_options
951+
external/basisu/encoder/basisu_comp.cpp
952+
COMPILE_OPTIONS
953+
)
954+
set_source_files_properties(
955+
${BASISU_ENCODER_CXX_SRC}
956+
PROPERTIES COMPILE_OPTIONS "${cur_options};-fno-strict-aliasing"
957+
)
958+
get_source_file_property(cur_options
959+
external/basisu/transcoder/basisu_transcoder.cpp
960+
COMPILE_OPTIONS
961+
)
962+
set_source_files_properties(
963+
external/basisu/transcoder/basisu_transcoder.cpp
964+
PROPERTIES COMPILE_OPTIONS "${cur_options};-fno-strict-aliasing"
965+
)
966+
endif()
967+
948968
# Retrieve the final set of properties for use by the transcodetests.
949969
# We do this because the CMake feature that would allow the transcodetests
950970
# target to retrieve these from the ktx target are not available until

0 commit comments

Comments
 (0)