老外真辛苦:
http://stackoverflow.com/questions/11580748/using-cmake-for-making-a-project-which-includes-mfc
http://www.cmake.org/Wiki/CMake_FAQ
You need to add _AFXDLL
to the preprocessor definitions and set the CMake variable CMAKE_MFC_FLAG
to 1
for the static MFC library, or 2
for the shared one.
add_definitions(-D_AFXDLL)
set(CMAKE_MFC_FLAG 1)
For further info run
cmake --help-variable CMAKE_MFC_FLAG