FindMFC — CMake 4.3.3 Documentation

# FindMFC

Finds the native Microsoft Foundation Class Library (MFC) for developing MFC applications on Windows:

    find_package(MFC [...])

Note

MFC is an optional component in Visual Studio and must be installed separately for this module to succeed.

Once the MFC libraries and headers are found, no additional manual linking is needed, as they are part of the development environment.

## Result Variables

This module defines the following variables:

`MFC_FOUND`

  Boolean indicating whether MFC support was found.

## Examples

Using this module to check if the application can link to the MFC libraries:

    find_package(MFC)

    if(MFC_FOUND)
      # Example logic when MFC is available...
      set(CMAKE_MFC_FLAG 2)
      add_executable(app WIN32 main.cpp)
      target_compile_definitions(app PRIVATE _AFXDLL)
    endif()

## See Also

- The `CMAKE_MFC_FLAG` variable.