Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using CMake for making a project which includes MFC

Tags:

cmake

mfc

I have a project in which I have to use a COM Module which uses MFC. I use CMake for making my project. Can anybody tell me what I have to include into my CMakeLists.txt so that I can use MFC in my project?

like image 730
user1540939 Avatar asked Oct 07 '22 04:10

user1540939


1 Answers

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
like image 146
Fraser Avatar answered Nov 04 '22 21:11

Fraser