2010-09-25 15:08:31 +00:00
|
|
|
# - Locate MFC libraries
|
|
|
|
# This module defines
|
|
|
|
# MFC_FOUND, if false, do not try to link to MFC
|
|
|
|
# MFC_LIBRARY_DIR, where to find libraries
|
|
|
|
# MFC_INCLUDE_DIR, where to find headers
|
|
|
|
|
2013-09-06 07:26:23 +00:00
|
|
|
IF(CustomMFC_FIND_REQUIRED)
|
|
|
|
SET(MFC_FIND_REQUIRED TRUE)
|
|
|
|
ENDIF(CustomMFC_FIND_REQUIRED)
|
|
|
|
|
|
|
|
IF(NOT MFC_DIR)
|
|
|
|
# If MFC have been found, remember their directory
|
2013-10-30 19:46:19 +00:00
|
|
|
IF(VC_DIR)
|
2013-09-06 07:26:23 +00:00
|
|
|
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
|
2013-10-30 19:46:19 +00:00
|
|
|
ENDIF(VC_DIR)
|
2010-09-25 15:08:31 +00:00
|
|
|
|
|
|
|
FIND_PATH(MFC_DIR
|
|
|
|
include/afxwin.h
|
2013-09-06 07:26:23 +00:00
|
|
|
HINTS
|
2010-09-25 15:08:31 +00:00
|
|
|
${MFC_STANDARD_DIR}
|
|
|
|
)
|
2013-09-06 07:26:23 +00:00
|
|
|
ENDIF(NOT MFC_DIR)
|
2010-09-25 15:08:31 +00:00
|
|
|
|
2013-09-06 07:26:23 +00:00
|
|
|
# Display an error message if MFC are not found, MFC_FOUND is updated
|
|
|
|
# User will be able to update MFC_DIR to the correct directory
|
|
|
|
INCLUDE(FindPackageHandleStandardArgs)
|
|
|
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
|
2010-09-25 15:08:31 +00:00
|
|
|
|
2013-09-06 07:26:23 +00:00
|
|
|
IF(MFC_FOUND)
|
|
|
|
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
|
|
|
|
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
|
2010-09-25 15:08:31 +00:00
|
|
|
|
|
|
|
# Using 32 or 64 bits libraries
|
2011-05-14 12:05:45 +00:00
|
|
|
IF(TARGET_X64)
|
2010-09-25 15:08:31 +00:00
|
|
|
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
|
2011-05-14 12:05:45 +00:00
|
|
|
ELSE(TARGET_X64)
|
2010-09-25 15:08:31 +00:00
|
|
|
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
|
2011-05-14 12:05:45 +00:00
|
|
|
ENDIF(TARGET_X64)
|
2010-09-25 15:08:31 +00:00
|
|
|
|
|
|
|
# Add MFC libraries directory to default library path
|
|
|
|
LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
|
|
|
|
|
|
|
|
# Set definitions for using MFC in DLL
|
|
|
|
SET(MFC_DEFINITIONS -D_AFXDLL)
|
2013-10-30 19:46:19 +00:00
|
|
|
|
|
|
|
# Set CMake flag to use MFC DLL
|
|
|
|
SET(CMAKE_MFC_FLAG 2)
|
2015-12-15 12:41:27 +00:00
|
|
|
ENDIF()
|
2010-09-25 15:08:31 +00:00
|
|
|
|
|
|
|
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project
|