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 #=============================================================================
8 # Copyright 2002-2009 Kitware, Inc.
10 # Distributed under the OSI-approved BSD License (the "License");
11 # see accompanying file Copyright.txt for details.
13 # This software is distributed WITHOUT ANY WARRANTY; without even the
14 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
15 # See the License for more information.
16 #=============================================================================
17 # (To distribute this file outside of CMake, substitute the full
18 # License text for the above reference.)
20 # Assume no MFC support
23 # Only attempt the try_compile call if it has a chance to succeed:
24 set(MFC_ATTEMPT_TRY_COMPILE 0)
25 if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
26 set(MFC_ATTEMPT_TRY_COMPILE 1)
29 if(MFC_ATTEMPT_TRY_COMPILE)
30 if("MFC_HAVE_MFC" MATCHES "^MFC_HAVE_MFC$")
31 set(CHECK_INCLUDE_FILE_VAR "afxwin.h")
32 configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
33 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
34 message(STATUS "Looking for MFC")
35 try_compile(MFC_HAVE_MFC
37 ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
39 -DCMAKE_MFC_FLAG:STRING=2
40 -DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
41 OUTPUT_VARIABLE OUTPUT)
43 message(STATUS "Looking for MFC - found")
44 set(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
45 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
46 "Determining if MFC exists passed with the following output:\n"
49 message(STATUS "Looking for MFC - not found")
50 set(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
51 file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
52 "Determining if MFC exists failed with the following output:\n"