MSYS2, RTools etc.
I get a (false positive) threat alert from Windows Defender when running cmake from MSYS2. The point at which it fails is very simple stuff from CheckFloatingPointFormat.cmake. The script is basically compiling CheckFloatingPointFormat.c, and then grepping it to check if it finds ABCDEFGH in the binary. Windows Defender does not like the exe, for whatever reasons, maybe some viruses use the same logic to investigate their victims.
Since we do not need an executable, a static library is fine, so I add a line and Windows Defender is silent again:
SET(UB_CHECK_FLOATING_POINT_FORMAT_TARGET "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CheckFloatingPointFormat.bin")
SET(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) # added
TRY_COMPILE(HAVE_${IEEE754_FLOATS} "${CMAKE_BINARY_DIR}"
"${UB_DIRECTORY_OF_CHECK_FLOATING_POINT_FORMAT_SCRIPT}/CheckFloatingPointFormat.c"
COPY_FILE "${UB_CHECK_FLOATING_POINT_FORMAT_TARGET}")
I’ll make the respective PR.
What I am wondering, though: The little program is used to detect if the system is little endian or big endian at compile time. But this refers to the host, not to the target (e.g., when crosscompiling). Shouldn’t such a test be made at runtime?