Fixed: CMAKE_MAKE_PROGRAM or CMAKE_CXX_COMPILER can have relative path

This commit is contained in:
kervala 2010-09-28 00:03:11 +02:00
parent 73e5befa12
commit f88ded7ee0
2 changed files with 12 additions and 5 deletions

View file

@ -92,6 +92,15 @@ IF(WIN32)
INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake) INCLUDE(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake)
SET(WINSOCK2_LIB ws2_32.lib) SET(WINSOCK2_LIB ws2_32.lib)
IF(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# convert IDE fullpath to VC++ path
STRING(REGEX REPLACE "Common7/IDE/.+" "VC" VC_DIR ${CMAKE_MAKE_PROGRAM})
ELSE(${CMAKE_MAKE_PROGRAM} MATCHES "Common7")
# 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) IF(WITH_MFC)
FIND_PACKAGE(CustomMFC REQUIRED) FIND_PACKAGE(CustomMFC REQUIRED)
ENDIF(WITH_MFC) ENDIF(WITH_MFC)
@ -108,8 +117,6 @@ IF(WITH_STLPORT)
INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR})
IF(WIN32) IF(WIN32)
FIND_PACKAGE(WindowsSDK REQUIRED) FIND_PACKAGE(WindowsSDK REQUIRED)
# convert IDE fullpath to include path
STRING(REGEX REPLACE "VC/bin/.+" "VC/include" VC_INCLUDE_DIR ${CMAKE_CXX_COMPILER})
# use VC++ and Windows SDK include paths # use VC++ and Windows SDK include paths
INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) INCLUDE_DIRECTORIES(${VC_INCLUDE_DIR} ${WINSDK_INCLUDE_DIR})
ENDIF(WIN32) ENDIF(WIN32)

View file

@ -10,9 +10,9 @@ FIND_PACKAGE(MFC)
SET(CUSTOM_MFC_DIR FALSE) SET(CUSTOM_MFC_DIR FALSE)
# If using STLport and MFC have been found, remember its directory # If using STLport and MFC have been found, remember its directory
IF(WITH_STLPORT AND MFC_FOUND) IF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
STRING(REGEX REPLACE "VC/bin/.+" "VC/atlmfc" VC_INCLUDE_DIR ${CMAKE_CXX_COMPILER}) SET(MFC_STANDARD_DIR "${VC_DIR}/atlmfc")
ENDIF(WITH_STLPORT AND MFC_FOUND) ENDIF(WITH_STLPORT AND MFC_FOUND AND VC_DIR)
# If using STLport or MFC haven't been found, search for afxwin.h # If using STLport or MFC haven't been found, search for afxwin.h
IF(WITH_STLPORT OR NOT MFC_FOUND) IF(WITH_STLPORT OR NOT MFC_FOUND)