From 9d5fef34913d24b819ca4b1d87e7915b0dd12a81 Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 29 Sep 2010 23:55:57 +0200 Subject: [PATCH] Fixed: Bad detection of MFC --- code/CMakeLists.txt | 20 ++++++++++++-------- code/CMakeModules/FindCustomMFC.cmake | 1 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index f9ae8a78d..1e1ef2811 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -59,8 +59,9 @@ SET(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) IF(WIN32) - FIND_PACKAGE(External REQUIRED) - FIND_PACKAGE(MFC QUIET) + IF(WITH_MFC) + FIND_PACKAGE(MFC QUIET) + ENDIF(WITH_MFC) IF(NOT DEFINED ENV{QTDIR}) SET(ENV{QTDIR} "c:/qt/4.6.3") @@ -86,15 +87,12 @@ ENDIF(NOT WIN32) #----------------------------------------------------------------------------- #Platform specifics -FIND_PACKAGE(Threads REQUIRED) -FIND_PACKAGE(LibXml2 REQUIRED) -FIND_PACKAGE(PNG REQUIRED) -FIND_PACKAGE(Jpeg) - IF(WIN32) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) SET(WINSOCK2_LIB ws2_32.lib) + FIND_PACKAGE(External REQUIRED) + IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") # convert IDE fullpath to VC++ path STRING(REGEX REPLACE "Common7/IDE/.+" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM}) @@ -102,13 +100,17 @@ IF(WIN32) # convert compiler fullpath to VC++ path STRING(REGEX REPLACE "VC/bin/.+" "VC" VC_DIR ${CMAKE_CXX_COMPILER}) ENDIF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7") - SET(VC_INCLUDE_DIR "${VC_DIR}/include") IF(WITH_MFC) FIND_PACKAGE(CustomMFC REQUIRED) ENDIF(WITH_MFC) ENDIF(WIN32) +FIND_PACKAGE(Threads REQUIRED) +FIND_PACKAGE(LibXml2 REQUIRED) +FIND_PACKAGE(PNG REQUIRED) +FIND_PACKAGE(Jpeg) + IF(WITH_STATIC) # libxml2 could need winsock2 library SET(LIBXML2_DEFINITIONS ${LIBXML2_DEFINITIONS} -DLIBXML_STATIC) @@ -119,6 +121,8 @@ IF(WITH_STLPORT) FIND_PACKAGE(STLport REQUIRED) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) IF(WIN32) + SET(VC_INCLUDE_DIR "${VC_DIR}/include") + FIND_PACKAGE(WindowsSDK REQUIRED) # use VC++ and Windows SDK include paths INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) diff --git a/code/CMakeModules/FindCustomMFC.cmake b/code/CMakeModules/FindCustomMFC.cmake index 4445c5c1b..e37936ef0 100644 --- a/code/CMakeModules/FindCustomMFC.cmake +++ b/code/CMakeModules/FindCustomMFC.cmake @@ -28,6 +28,7 @@ IF(WITH_STLPORT OR NOT MFC_FOUND) # 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) IF(MFC_FOUND)