Changed: Improved MFC module

This commit is contained in:
kervala 2013-09-06 09:26:23 +02:00
parent 4a4b9b5ab8
commit 3a7cee4aa7

View file

@ -4,42 +4,35 @@
# MFC_LIBRARY_DIR, where to find libraries # MFC_LIBRARY_DIR, where to find libraries
# MFC_INCLUDE_DIR, where to find headers # MFC_INCLUDE_DIR, where to find headers
IF(CustomMFC_FIND_REQUIRED)
SET(MFC_FIND_REQUIRED TRUE)
ENDIF(CustomMFC_FIND_REQUIRED)
# Try to find MFC using official module, MFC_FOUND is set # Try to find MFC using official module, MFC_FOUND is set
FIND_PACKAGE(MFC) FIND_PACKAGE(MFC)
SET(CUSTOM_MFC_DIR FALSE) IF(NOT MFC_DIR)
# If MFC have been found, remember their directory
# If using STLport and MFC have been found, remember its directory IF(MFC_FOUND AND VC_DIR)
IF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc") SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(WITH_STLPORT AND MFC_FOUND AND VC_DIR) ENDIF(MFC_FOUND AND VC_DIR)
# If using STLport or MFC haven't been found, search for afxwin.h
IF(WITH_STLPORT OR NOT MFC_FOUND)
FIND_PATH(MFC_DIR FIND_PATH(MFC_DIR
include/afxwin.h include/afxwin.h
PATHS HINTS
${MFC_STANDARD_DIR} ${MFC_STANDARD_DIR}
) )
ENDIF(NOT MFC_DIR)
IF(CustomMFC_FIND_REQUIRED) # Display an error message if MFC are not found, MFC_FOUND is updated
SET(MFC_FIND_REQUIRED TRUE) # User will be able to update MFC_DIR to the correct directory
ENDIF(CustomMFC_FIND_REQUIRED) INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
# Display an error message if MFC are not found, MFC_FOUND is updated IF(MFC_FOUND)
# User will be able to update MFC_DIR to the correct directory
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MFC DEFAULT_MSG MFC_DIR)
IF(MFC_FOUND)
SET(CUSTOM_MFC_DIR TRUE)
SET(MFC_INCLUDE_DIR "${MFC_DIR}/include") SET(MFC_INCLUDE_DIR "${MFC_DIR}/include")
INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${MFC_INCLUDE_DIR})
ENDIF(MFC_FOUND)
ENDIF(WITH_STLPORT OR NOT MFC_FOUND)
# Only if using a custom path
IF(CUSTOM_MFC_DIR)
# Using 32 or 64 bits libraries # Using 32 or 64 bits libraries
IF(TARGET_X64) IF(TARGET_X64)
SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64") SET(MFC_LIBRARY_DIR "${MFC_DIR}/lib/amd64")
@ -49,9 +42,7 @@ IF(CUSTOM_MFC_DIR)
# Add MFC libraries directory to default library path # Add MFC libraries directory to default library path
LINK_DIRECTORIES(${MFC_LIBRARY_DIR}) LINK_DIRECTORIES(${MFC_LIBRARY_DIR})
ENDIF(CUSTOM_MFC_DIR)
IF(MFC_FOUND)
# Set definitions for using MFC in DLL # Set definitions for using MFC in DLL
SET(MFC_DEFINITIONS -D_AFXDLL) SET(MFC_DEFINITIONS -D_AFXDLL)
ENDIF(MFC_FOUND) ENDIF(MFC_FOUND)