@@ -25,10 +25,6 @@ if(MSVC)
2525 set (CMAKE_GENERATOR_CC cl)
2626endif ()
2727
28- if (ARCH STREQUAL "aarch64" AND CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT "${CMAKE_VS_PLATFORM_TOOLSET} " MATCHES "ClangCL" )
29- message (FATAL_ERROR "AWS-LC Windows/ARM64 assembly code requires ClangCL. Current toolset: ${CMAKE_VS_PLATFORM_TOOLSET} " )
30- endif ()
31-
3228include (sources .cmake)
3329include (TestBigEndian)
3430include (CheckCCompilerFlag)
@@ -658,18 +654,19 @@ elseif(MSVC)
658654 set (CMAKE_C_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR} " )
659655 set (CMAKE_CXX_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR} " )
660656
661- # If we're using MSVC on Windows in FIPS mode with RelWithDebInfo then we want to override some of the default RelWithDebInfo flags.
662- # This fixes the problem we run into with RelWithDebInfo and FIPS mode on Windows where the FIPS module wouldn't span the expected symbol.
663- if (CMAKE_BUILD_TYPE_LOWER MATCHES "relwithdebinfo" AND FIPS)
664- # /Zi requires the /debug flag for executables/libraries that we want .pdb files for.
665- # We want to replace the default /debug flag with /DEBUG:FULL, to explicitly make sure that the .pdb files can be used on machines other than one on which it's built.
666- string (REPLACE "/debug" "/DEBUG:FULL" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} " )
667- string (REPLACE "/debug" "/DEBUG:FULL" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} " )
668-
669- # The /debug flag also turns off the /OPT linker flag so we want to turn them back on across the board.
670- set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR" )
671- set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR" )
672- endif ()
657+ endif ()
658+
659+ # If we're using MSVC on Windows in FIPS mode with RelWithDebInfo then we want to override some of the default RelWithDebInfo flags.
660+ # This fixes the problem we run into with RelWithDebInfo and FIPS mode on Windows where the FIPS module wouldn't span the expected symbol.
661+ if (MSVC AND CMAKE_BUILD_TYPE_LOWER MATCHES "relwithdebinfo" AND FIPS)
662+ # /Zi requires the /debug flag for executables/libraries that we want .pdb files for.
663+ # We want to replace the default /debug flag with /DEBUG:FULL, to explicitly make sure that the .pdb files can be used on machines other than one on which it's built.
664+ string (REPLACE "/debug" "/DEBUG:FULL" CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} " )
665+ string (REPLACE "/debug" "/DEBUG:FULL" CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} " )
666+
667+ # The /debug flag also turns off the /OPT linker flag so we want to turn them back on across the board.
668+ set (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR" )
669+ set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR" )
673670endif ()
674671
675672if (WIN32 )
@@ -810,9 +807,7 @@ if(FIPS)
810807 message (FATAL_ERROR "Static FIPS build of AWS-LC is supported only on Linux" )
811808 endif ()
812809
813- if (WIN32 AND CMAKE_BUILD_TYPE_LOWER STREQUAL "debug" )
814- message (FATAL_ERROR "Windows Debug build is not supported with FIPS, use Release or RelWithDebInfo" )
815- endif ()
810+
816811
817812 string (REGEX MATCH "(^| )-DAWSLC_FIPS_FAILURE_CALLBACK($| )" FIPS_CALLBACK_ENABLED "${CMAKE_C_FLAGS} " )
818813 if (FIPS_CALLBACK_ENABLED AND BUILD_SHARED_LIBS )
@@ -924,6 +919,14 @@ else()
924919 set (ARCH "generic" )
925920endif ()
926921
922+ if (ARCH STREQUAL "aarch64" AND CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT "${CMAKE_VS_PLATFORM_TOOLSET} " MATCHES "ClangCL" )
923+ message (FATAL_ERROR "AWS-LC Windows/ARM64 assembly code requires ClangCL. Current toolset: ${CMAKE_VS_PLATFORM_TOOLSET} " )
924+ endif ()
925+
926+ if (WIN32 AND FIPS AND (CMAKE_BUILD_TYPE_LOWER STREQUAL "debug" OR (CMAKE_BUILD_TYPE_LOWER STREQUAL "relwithdebinfo" AND ARCH STREQUAL "aarch64" )))
927+ message (FATAL_ERROR "Windows Debug and RelWithDebInfo builds are not supported with FIPS, use Release" )
928+ endif ()
929+
927930# If target ARCH is 32-bit x86, ensure SSE2 is enabled since it's used by the optimized assembly.
928931# To build for targets that do not support SSE2, use the `OPENSSL_NO_ASM` flag.
929932if (ARCH STREQUAL "x86" AND NOT OPENSSL_NO_SSE2_FOR_TESTING)
0 commit comments