khanat-opennel-code/code/CMakeModules/FindCustomMFC.cmake

51 lines
1.4 KiB
CMake
Raw Normal View History

# - 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)
FIND_PATH(MFC_DIR
include/afxwin.h
2013-09-06 07:26:23 +00:00
HINTS
${MFC_STANDARD_DIR}
)
2013-09-06 07:26:23 +00:00
ENDIF(NOT MFC_DIR)
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)
2013-09-06 07:26:23 +00:00
IF(MFC_FOUND)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
# Using 32 or 64 bits libraries
IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
ELSE(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib")
ENDIF(TARGET_X64)
# 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()
# TODO: create a macro which set MFC_DEFINITIONS, MFC_LIBRARY_DIR and MFC_INCLUDE_DIR for a project