Reply To: MWEdit

Home Forums Projects MWEdit Reply To: MWEdit

#5333
DeVaultSetter
Keymaster

    Just paranoia, are we absolutely sure MSVC compiler is detected?

    if(MSVC)
    message(STATUS “MSVC compiler detected. Adding specific flags.”)
    # Blah target_compile_options(MyApp PRIVATE “/EHsc”) # Enable standard C++ exception handling
    elseif(${CMAKE_CXX_COMPILER_ID} MATCHES “GNU”)
    message(STATUS “GNU compiler detected.”)
    # Add GNU specific flags here
    endif()

    MSVC is supposed to define _WINDOWS internally or something – can you tell if that is working A_OK?
    Edit: Sounds silly, but version checking for MSVC might go as:

    if(MSVC)
    message(STATUS “Microsoft Visual C++ compiler detected.”)
    message(STATUS “MSVC version: ${MSVC_VERSION}”)
    message(STATUS “MSVC toolset version: ${MSVC_TOOLSET_VERSION}”)

    # Example: Require a minimum version
    if(${MSVC_VERSION} VERSION_LESS 19.10)
    message(FATAL_ERROR “MSVC version older than Visual Studio 2017 (v15) is not supported.”)
    endif()

    # Example: Apply specific flags for a certain version
    if(${MSVC_VERSION} VERSION_GREATER_EQUAL 19.28)
    # Code to handle features available in newer VS 2019 versions (16.8+)
    add_definitions(…)
    endif()

    Just in case of an issue with _AFXDLL, also try adding the following in the mfc section maybe before the PUBLIC _AFXDLL bit:

    add_definitions(-D_AFXDLL)

    More paranoia – although you are sure to have covered most of this stuff: VS is configured to “Use MFC in a Shared DLL”?
    Not sure – if std_afx.h is used with underscore instead of stdafx.h, it must be configured as so in VS Precompiled headers section.
    Also in the stdafx.h, specify the versions of Windows required for MWEdit with _WIN32_WINNT – e.g. W10.11: 0x0A00