diff --git a/CMakeLists.txt b/CMakeLists.txt index 996eb25..e573c15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -35,7 +35,9 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) endif () # These are shared by bddisasm and bdshemu. -if (NOT MSVC) +if (MSVC OR "${CMAKE_C_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC") + set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX) +else () set(BDDISASM_COMMON_COMPILE_OPTIONS "$<$:-U_FORTIFY_SOURCE>" "$<$:-D_FORTIFY_SOURCE=2>" @@ -68,8 +70,6 @@ if (NOT MSVC) -gdwarf-4 -grecord-gcc-switches -march=westmere) -else () - set(BDDISASM_COMMON_COMPILE_OPTIONS /W4 /WX) endif () set(BDDISASM_PUBLIC_HEADERS @@ -91,6 +91,7 @@ set(BDDISASM_INSTALL_INCLUDE_DIR include(CheckFunctionExists) include(CheckSymbolExists) +include(CheckCCompilerFlag) add_library( bddisasm STATIC @@ -171,7 +172,9 @@ target_include_directories(bddisasm PUBLIC $= ARRAYSIZE(Options->ShemuRegs)) + if (regIdx < 0 || regIdx >= (INT32)ARRAYSIZE(Options->ShemuRegs)) { if (!_stricmp(regStr, "rip")) {