1 # - Find MFC on Windows
2 # Find the native MFC - i.e. decide if an application can link to the MFC
4 # MFC_FOUND - Was MFC support found
5 # You don't need to include anything or link anything to use it.
7 # Assume no MFC support
10 # Only attempt the try_compile call if it has a chance to succeed:
11 SET(MFC_ATTEMPT_TRY_COMPILE 0)
12 IF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
13 SET(MFC_ATTEMPT_TRY_COMPILE 1)
14 ENDIF(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
16 IF(MFC_ATTEMPT_TRY_COMPILE)
17 IF("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$")
18 SET(CHECK_INCLUDE_FILE_VAR "afxwin.h")
19 CONFIGURE_FILE(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
20 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
21 MESSAGE(STATUS "Looking for MFC")
22 TRY_COMPILE(MFC_HAVE_MFC
24 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
26 -DCMAKE_MFC_FLAG:STRING=2
27 -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
28 OUTPUT_VARIABLE OUTPUT)
30 MESSAGE(STATUS "Looking for MFC - found")
31 SET(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
32 FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
33 "Determining if MFC exists passed with the following output:\n"
36 MESSAGE(STATUS "Looking for MFC - not found")
37 SET(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
38 FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
39 "Determining if MFC exists failed with the following output:\n"
42 ENDIF("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$")
47 ENDIF(MFC_ATTEMPT_TRY_COMPILE)