Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup native build warnings and unnecessary logos #91563

Merged
merged 4 commits into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions eng/native/configurecompiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,19 @@ add_compile_definitions("$<$<CONFIG:CHECKED>:DEBUG;_DEBUG;_DBG;URTBLDENV_FRIENDL
add_compile_definitions("$<$<OR:$<CONFIG:RELEASE>,$<CONFIG:RELWITHDEBINFO>>:NDEBUG;URTBLDENV_FRIENDLY=Retail>")

if (MSVC)
add_linker_flag(/guard:cf)

define_property(TARGET PROPERTY CLR_CONTROL_FLOW_GUARD INHERITED BRIEF_DOCS "Controls the /guard:cf flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:cf compiler and linker flag should be present")
define_property(TARGET PROPERTY CLR_EH_CONTINUATION INHERITED BRIEF_DOCS "Controls the /guard:ehcont flag presence" FULL_DOCS "Set this property to ON or OFF to indicate if the /guard:ehcont compiler flag should be present")
define_property(TARGET PROPERTY CLR_EH_OPTION INHERITED BRIEF_DOCS "Defines the value of the /EH option" FULL_DOCS "Set this property to one of the valid /EHxx options (/EHa, /EHsc, /EHa-, ...)")

set_property(GLOBAL PROPERTY CLR_CONTROL_FLOW_GUARD ON)

# Remove the /EHsc from the CXX flags so that the compile options are the only source of truth for that
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set_property(GLOBAL PROPERTY CLR_EH_OPTION /EHsc)

add_compile_options($<$<COMPILE_LANGUAGE:CXX>:$<TARGET_PROPERTY:CLR_EH_OPTION>>)
add_link_options($<$<BOOL:$<TARGET_PROPERTY:CLR_CONTROL_FLOW_GUARD>>:/guard:cf>)

# Linker flags
#
Expand Down Expand Up @@ -841,7 +853,7 @@ if (MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Gz>)
endif (CLR_CMAKE_HOST_ARCH_I386)

add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>>:/GL>)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION $<AND:$<COMPILE_LANGUAGE:C,CXX>,$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>>)

if (CLR_CMAKE_HOST_ARCH_AMD64)
# The generator expression in the following command means that the /homeparams option is added only for debug builds for C and C++ source files
Expand All @@ -850,16 +862,15 @@ if (MSVC)

# enable control-flow-guard support for native components for non-Arm64 builds
# Added using variables instead of add_compile_options to let individual projects override it
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:cf")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:cf")
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<BOOL:$<TARGET_PROPERTY:CLR_CONTROL_FLOW_GUARD>>>:/guard:cf>)

# Enable EH-continuation table and CET-compatibility for native components for amd64 builds except for components of the Mono
# runtime. Added some switches using variables instead of add_compile_options to let individual projects override it.
if (CLR_CMAKE_HOST_ARCH_AMD64 AND NOT CLR_CMAKE_RUNTIME_MONO)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /guard:ehcont")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /guard:ehcont")
set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /guard:ehcont")
add_linker_flag(/guard:ehcont)
set_property(GLOBAL PROPERTY CLR_EH_CONTINUATION ON)

add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX,ASM_MASM>,$<BOOL:$<TARGET_PROPERTY:CLR_EH_CONTINUATION>>>:/guard:ehcont>)
add_link_options($<$<BOOL:$<TARGET_PROPERTY:CLR_EH_CONTINUATION>>:/guard:ehcont>)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /CETCOMPAT")
endif (CLR_CMAKE_HOST_ARCH_AMD64 AND NOT CLR_CMAKE_RUNTIME_MONO)

Expand Down Expand Up @@ -888,7 +899,9 @@ if (MSVC)
endif (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64)

# Don't display the output header when building RC files.
add_compile_options($<$<COMPILE_LANGUAGE:RC>:/nologo>)
set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} /nologo")
# Don't display the output header when building asm files.
set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /nologo")
endif (MSVC)

# Configure non-MSVC compiler flags that apply to all platforms (unix-like or otherwise)
Expand Down
12 changes: 3 additions & 9 deletions eng/native/ijw/IJW.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,13 @@ if (CLR_CMAKE_HOST_WIN32)

function(remove_ijw_incompatible_options options updatedOptions)
# IJW isn't compatible with Ehsc, which CMake enables by default
if(options MATCHES "/EHsc")
string(REPLACE "/EHsc" "" options "${options}")
endif()
set_property(DIRECTORY PROPERTY CLR_EH_OPTION "")

# IJW isn't compatible with CFG
if(options MATCHES "/guard:cf")
string(REPLACE "/guard:cf" "" options "${options}")
endif()
set_property(DIRECTORY PROPERTY CLR_CONTROL_FLOW_GUARD OFF)

# IJW isn't compatible with EHCONT, which requires CFG
if(options MATCHES "/guard:ehcont")
string(REPLACE "/guard:ehcont" "" options "${options}")
endif()
set_property(DIRECTORY PROPERTY CLR_EH_CONTINUATION OFF)

# IJW isn't compatible with GR-
if(options MATCHES "/GR-")
Expand Down
3 changes: 1 addition & 2 deletions src/coreclr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ endif()
# Enable C++ EH with SEH
#-------------------------
if (MSVC)
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHa>) # enable C++ EH (w/ SEH exceptions)
set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHa) # enable C++ EH (w/ SEH exceptions)
endif()

#-------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/dlls/mscordac/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ if(CLR_CMAKE_HOST_WIN32)
add_custom_command(
DEPENDS mscordaccore_def "${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def" mscordacobj daccess
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/mscordaccore.exp
COMMAND lib.exe /OUT:"${CMAKE_CURRENT_BINARY_DIR}/mscordaccore.lib" /DEF:"${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def" "$<TARGET_FILE:daccess>" $<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/LTCG> ${STATIC_LIBRARY_FLAGS} $<TARGET_OBJECTS:mscordacobj>
COMMAND lib.exe /NOLOGO /OUT:"${CMAKE_CURRENT_BINARY_DIR}/mscordaccore.lib" /DEF:"${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def" "$<TARGET_FILE:daccess>" $<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/LTCG> ${STATIC_LIBRARY_FLAGS} $<TARGET_OBJECTS:mscordacobj>
COMMENT "Generating mscordaccore.exp export file"
)

Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/inc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if(CLR_CMAKE_HOST_WIN32)
set(OUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}_i.c)
list(APPEND CORGUIDS_SOURCES ${OUT_NAME})
add_custom_command(OUTPUT ${OUT_NAME}
COMMAND ${MIDL} ${MIDL_INCLUDE_DIRECTORIES} /no_stamp /h ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}.h ${MIDL_DEFINITIONS} /out ${CMAKE_CURRENT_BINARY_DIR}/idls_out ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
COMMAND ${MIDL} ${MIDL_INCLUDE_DIRECTORIES} /nologo /no_stamp /h ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}.h ${MIDL_DEFINITIONS} /out ${CMAKE_CURRENT_BINARY_DIR}/idls_out ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
COMMENT "Compiling ${GENERATE_IDL}")
endforeach(GENERATE_IDL)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Bootstrap/base/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ install_bootstrapper_object(bootstrapper aotsdk)
if (CLR_CMAKE_TARGET_WIN32)
add_library(bootstrapper.GuardCF OBJECT ${SOURCES})
install_bootstrapper_object(bootstrapper.GuardCF aotsdk)
target_compile_options(bootstrapper.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
set_target_properties(bootstrapper.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)
else()
add_library(stdc++compat STATIC ../stdcppshim.cpp)
install_static_library(stdc++compat aotsdk nativeaot)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Bootstrap/dll/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ install_bootstrapper_object(bootstrapperdll aotsdk)
if (CLR_CMAKE_TARGET_WIN32)
add_library(bootstrapperdll.GuardCF STATIC ${SOURCES})
install_bootstrapper_object(bootstrapperdll.GuardCF aotsdk)
target_compile_options(bootstrapperdll.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
set_target_properties(bootstrapperdll.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)
endif()
15 changes: 3 additions & 12 deletions src/coreclr/nativeaot/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,11 @@ if(WIN32)
endif (WIN32)

if(MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHa->) # Native AOT runtime does not use C++ exception handling
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHs->)

# CFG runtime checks in C++ code are unnecessary overhead unless Native AOT compiler produces CFG compliant code as well
# and CFG is enabled in the linker
if(CMAKE_CXX_FLAGS MATCHES "/guard:cf")
string(REPLACE "/guard:cf" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
endif()
if(CMAKE_C_FLAGS MATCHES "/guard:cf")
string(REPLACE "/guard:cf" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
endif()
set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHa-s-) # Native AOT runtime does not use C++ exception handling
set_property(DIRECTORY PROPERTY CLR_CONTROL_FLOW_GUARD OFF)

# The code generated by the Native AOT compiler doesn't work with Link Time Code Generation
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/GL->)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION OFF)

# Sets the options that create the fastest code in the majority of cases
add_compile_options($<$<AND:$<COMPILE_LANGUAGE:C,CXX>,$<CONFIG:Release>>:/O2>)
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ target_compile_definitions(Runtime.ServerGC PRIVATE -DFEATURE_SVR_GC)
if (CLR_CMAKE_TARGET_WIN32)
add_library(Runtime.ServerGC.GuardCF STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM} ${SERVER_GC_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS})
target_compile_definitions(Runtime.ServerGC.GuardCF PRIVATE -DFEATURE_SVR_GC)
target_compile_options(Runtime.ServerGC.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
set_target_properties(Runtime.ServerGC.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)

if (CLR_CMAKE_TARGET_ARCH_AMD64)
add_library(Runtime.VxsortEnabled.GuardCF STATIC ${VXSORT_SOURCES})
target_compile_options(Runtime.VxsortEnabled.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
set_target_properties(Runtime.VxsortEnabled.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)
endif (CLR_CMAKE_TARGET_ARCH_AMD64)
endif (CLR_CMAKE_TARGET_WIN32)

Expand All @@ -55,7 +55,7 @@ set(ASM_OFFSETS_CSPP ${RUNTIME_DIR}/../Runtime.Base/src/AsmOffsets.cspp)

if(WIN32)
set(COMPILER_LANGUAGE "")
set(PREPROCESSOR_FLAGS -EP)
set(PREPROCESSOR_FLAGS -EP -nologo)
set(ASM_OFFSETS_CPP ${RUNTIME_DIR}/windows/AsmOffsets.cpp)
else()
set(COMPILER_LANGUAGE -x c++)
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/nativeaot/Runtime/Portable/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ set(ASM_OFFSETS_CSPP ${RUNTIME_DIR}/../Runtime.Base/src/AsmOffsets.cspp)

if(WIN32)
set(COMPILER_LANGUAGE "")
set(PREPROCESSOR_FLAGS -EP)
set(PREPROCESSOR_FLAGS -EP -nologo)
set(ASM_OFFSETS_CPP ${RUNTIME_DIR}/windows/AsmOffsets.cpp)
else()
set(COMPILER_LANGUAGE -x c++)
Expand Down
4 changes: 2 additions & 2 deletions src/coreclr/nativeaot/Runtime/eventpipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ add_library(eventpipe-disabled STATIC ${AOT_EVENTPIPE_DISABLED_SOURCES})
if (CLR_CMAKE_TARGET_WIN32)
add_library(eventpipe-enabled.GuardCF STATIC ${EVENTPIPE_SOURCES})
add_library(eventpipe-disabled.GuardCF STATIC ${AOT_EVENTPIPE_DISABLED_SOURCES})
target_compile_options(eventpipe-enabled.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
target_compile_options(eventpipe-disabled.GuardCF PRIVATE $<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:/guard:cf>)
set_target_properties(eventpipe-enabled.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)
set_target_properties(eventpipe-disabled.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON)
endif (CLR_CMAKE_TARGET_WIN32)

install_static_library(eventpipe-enabled aotsdk nativeaot)
Expand Down
2 changes: 1 addition & 1 deletion src/native/corehost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)

if (MSVC)
# Host components don't try to handle asynchronous exceptions
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHsc>)
set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHsc)

# Explicitly re-enable warnings about declaration hiding (currently disabled by configurecompiler.cmake)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/we4456>) # declaration of 'identifier' hides previous local declaration
Expand Down
2 changes: 1 addition & 1 deletion src/native/corehost/apphost/static/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ include(../../hostcommon/files.cmake)

if(MSVC)
# Host components don't try to handle asynchronous exceptions
add_compile_options(/EHsc)
set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHsc)
elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
# Prevents libc from calling pthread_cond_destroy on static objects in
# dlopen()'ed library which we dlclose() in pal::unload_library.
Expand Down
2 changes: 1 addition & 1 deletion src/native/corehost/fxr/staticlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if (MSVC)
# We ship libhostfxr.lib as a static library for external consumption, so
# LTCG must be disabled to ensure that non-MSVC toolchains can work with it.

target_compile_options(libhostfxr PRIVATE /GL-)
set_target_properties(libhostfxr PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)

string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE})
string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO})
Expand Down
2 changes: 1 addition & 1 deletion src/native/corehost/nethost/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ if (MSVC)
# We ship libnethost.lib as a static library for external consumption, so
# LTCG must be disabled to ensure that non-MSVC toolchains can work with it.

target_compile_options(libnethost PRIVATE /GL-)
set_target_properties(libnethost PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)

string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELEASE ${CMAKE_STATIC_LINKER_FLAGS_RELEASE})
string(REPLACE "/LTCG" "" CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO ${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO})
Expand Down
1 change: 1 addition & 0 deletions src/native/corehost/test/typelibs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ function(compile_idl idl_file tlb_out)
/h ${CMAKE_CURRENT_BINARY_DIR}/${IDL_NAME}.h ${MIDL_DEFINITIONS}
/out ${CMAKE_CURRENT_BINARY_DIR}
/tlb ${tlb_out_local}
/nologo
${IDL_SOURCE}
DEPENDS ${IDL_SOURCE}
COMMENT "Compiling ${IDL_SOURCE}")
Expand Down
5 changes: 4 additions & 1 deletion src/native/external/libunwind_extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ if(CLR_CMAKE_HOST_WIN32)
endif ()

# Assume we are using default MSVC compiler
add_compile_options(/TC) # compile all files as C
add_compile_options(/permissive-)

# include paths
Expand Down Expand Up @@ -162,6 +161,10 @@ endif()
include(configure.cmake)
include(${CLR_SRC_NATIVE_DIR}/external/libunwind.cmake)

if(CLR_CMAKE_HOST_WIN32)
set_source_files_properties(${LIBUNWIND_SOURCES} PROPERTIES COMPILE_FLAGS /TC) # compile all files as C
endif(CLR_CMAKE_HOST_WIN32)

if(CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_HOST_OSX)
add_library(libunwind_dac OBJECT ${LIBUNWIND_SOURCES})
Expand Down
4 changes: 2 additions & 2 deletions src/native/libs/System.Globalization.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ if(CLR_CMAKE_TARGET_WIN32)
STATIC
${NATIVEGLOBALIZATION_SOURCES}
)
target_compile_options(System.Globalization.Native.Aot PRIVATE /guard:cf-)
target_compile_options(System.Globalization.Native.Aot PRIVATE /GL-)
set_target_properties(System.Globalization.Native.Aot PROPERTIES CLR_CONTROL_FLOW_GUARD OFF)
set_target_properties(System.Globalization.Native.Aot PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)

add_library(System.Globalization.Native.Aot.GuardCF
STATIC
Expand Down
4 changes: 2 additions & 2 deletions src/native/libs/System.IO.Compression.Native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ else ()
STATIC
${NATIVECOMPRESSION_SOURCES}
)
target_compile_options(System.IO.Compression.Native.Aot PRIVATE /guard:cf-)
target_compile_options(System.IO.Compression.Native.Aot PRIVATE /GL-)
set_target_properties(System.IO.Compression.Native.Aot PROPERTIES CLR_CONTROL_FLOW_GUARD OFF)
set_target_properties(System.IO.Compression.Native.Aot PROPERTIES INTERPROCEDURAL_OPTIMIZATION OFF)

add_library(System.IO.Compression.Native.Aot.GuardCF
STATIC
Expand Down
3 changes: 1 addition & 2 deletions src/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ if (CLR_CMAKE_HOST_WIN32)
# 5039 - pointer or reference to potentially throwing function passed to extern C function under -EHc. Undefined behavior may occur if this function throws an exception.
add_compile_options(-wd4100 -wd4244 -wd4514 -wd4625 -wd4626 -wd4668 -wd4710 -wd4711 -wd4774 -wd4820 -wd5025 -wd5026 -wd5027 -wd5039)

string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/EHa) # enable C++ EH (w/ SEH exceptions)
set_property(DIRECTORY PROPERTY CLR_EH_OPTION /EHa) # enable C++ EH (w/ SEH exceptions)
endif()

MACRO(SUBDIRLIST result curdir)
Expand Down