2013-10-15 19:17:36 +04:00
|
|
|
#.rst:
|
|
|
|
# FindMFC
|
|
|
|
# -------
|
|
|
|
#
|
|
|
|
# Find MFC on Windows
|
|
|
|
#
|
|
|
|
# Find the native MFC - i.e. decide if an application can link to the
|
|
|
|
# MFC libraries.
|
|
|
|
#
|
|
|
|
# ::
|
|
|
|
#
|
|
|
|
# MFC_FOUND - Was MFC support found
|
|
|
|
#
|
2002-09-03 20:29:03 +04:00
|
|
|
# You don't need to include anything or link anything to use it.
|
|
|
|
|
2009-09-28 19:45:50 +04:00
|
|
|
#=============================================================================
|
|
|
|
# Copyright 2002-2009 Kitware, Inc.
|
|
|
|
#
|
|
|
|
# Distributed under the OSI-approved BSD License (the "License");
|
|
|
|
# see accompanying file Copyright.txt for details.
|
|
|
|
#
|
|
|
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
|
|
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
# See the License for more information.
|
|
|
|
#=============================================================================
|
2010-08-07 04:48:47 +04:00
|
|
|
# (To distribute this file outside of CMake, substitute the full
|
2009-09-28 19:45:50 +04:00
|
|
|
# License text for the above reference.)
|
|
|
|
|
2002-09-03 20:29:03 +04:00
|
|
|
# Assume no MFC support
|
2012-08-13 21:47:32 +04:00
|
|
|
set(MFC_FOUND "NO")
|
2002-09-03 20:29:03 +04:00
|
|
|
|
2008-10-11 01:43:56 +04:00
|
|
|
# Only attempt the try_compile call if it has a chance to succeed:
|
2012-08-13 21:47:32 +04:00
|
|
|
set(MFC_ATTEMPT_TRY_COMPILE 0)
|
|
|
|
if(WIN32 AND NOT UNIX AND NOT BORLAND AND NOT MINGW)
|
|
|
|
set(MFC_ATTEMPT_TRY_COMPILE 1)
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
2002-09-03 20:29:03 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(MFC_ATTEMPT_TRY_COMPILE)
|
2015-03-26 16:00:32 +03:00
|
|
|
if(NOT DEFINED MFC_HAVE_MFC)
|
2012-08-13 21:47:32 +04:00
|
|
|
set(CHECK_INCLUDE_FILE_VAR "afxwin.h")
|
|
|
|
configure_file(${CMAKE_ROOT}/Modules/CheckIncludeFile.cxx.in
|
2008-10-11 01:43:56 +04:00
|
|
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx)
|
2012-08-13 21:47:32 +04:00
|
|
|
message(STATUS "Looking for MFC")
|
|
|
|
try_compile(MFC_HAVE_MFC
|
2008-10-11 01:43:56 +04:00
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFile.cxx
|
|
|
|
CMAKE_FLAGS
|
|
|
|
-DCMAKE_MFC_FLAG:STRING=2
|
|
|
|
-DCOMPILE_DEFINITIONS:STRING=-D_AFXDLL
|
|
|
|
OUTPUT_VARIABLE OUTPUT)
|
2012-08-13 21:47:32 +04:00
|
|
|
if(MFC_HAVE_MFC)
|
|
|
|
message(STATUS "Looking for MFC - found")
|
|
|
|
set(MFC_HAVE_MFC 1 CACHE INTERNAL "Have MFC?")
|
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
2008-10-11 01:43:56 +04:00
|
|
|
"Determining if MFC exists passed with the following output:\n"
|
|
|
|
"${OUTPUT}\n\n")
|
2012-08-13 21:50:14 +04:00
|
|
|
else()
|
2012-08-13 21:47:32 +04:00
|
|
|
message(STATUS "Looking for MFC - not found")
|
|
|
|
set(MFC_HAVE_MFC 0 CACHE INTERNAL "Have MFC?")
|
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
2008-10-11 01:43:56 +04:00
|
|
|
"Determining if MFC exists failed with the following output:\n"
|
|
|
|
"${OUTPUT}\n\n")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|
2008-10-11 01:43:56 +04:00
|
|
|
|
2012-08-13 21:47:32 +04:00
|
|
|
if(MFC_HAVE_MFC)
|
|
|
|
set(MFC_FOUND "YES")
|
2012-08-13 21:50:14 +04:00
|
|
|
endif()
|
|
|
|
endif()
|