From ee8055f5a34d3f8d3b824fc25a02a8c928b02c77 Mon Sep 17 00:00:00 2001 From: kervala Date: Tue, 14 Sep 2010 23:10:25 +0200 Subject: [PATCH] Fixed: STLport can't be used under Windows --- code/CMakeLists.txt | 19 +++++++++++++----- code/CMakeModules/FindWindowsSDK.cmake | 27 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 code/CMakeModules/FindWindowsSDK.cmake diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index bc4fc3035..5581dc326 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -86,11 +86,6 @@ NL_SETUP_PREFIX_PATHS() #----------------------------------------------------------------------------- #Platform specifics -IF(WITH_STLPORT) - FIND_PACKAGE(STLport REQUIRED) - INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) -ENDIF(WITH_STLPORT) - FIND_PACKAGE(Threads REQUIRED) FIND_PACKAGE(LibXml2 REQUIRED) FIND_PACKAGE(PNG REQUIRED) @@ -109,6 +104,20 @@ ENDIF(WITH_STATIC) NL_SETUP_BUILD() +IF(WITH_STLPORT) + FIND_PACKAGE(STLport REQUIRED) + INCLUDE_DIRECTORIES(${STLPORT_INCLUDE_DIR}) + IF(WIN32) + FIND_PACKAGE(WindowsSDK REQUIRED) + # convert IDE fullpath to include path + STRING(REGEX REPLACE "Common7/IDE/[A-Za-z]+\\.exe" "VC/include" VCINCLUDE_DIR ${CMAKE_MAKE_PROGRAM}) + # use VC++ and Windows SDK include paths + INCLUDE_DIRECTORIES(${VCINCLUDE_DIR} ${WINSDK_INCLUDE_DIR}) + # deactivate all global include paths + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /X") + ENDIF(WIN32) +ENDIF(WITH_STLPORT) + IF(WITH_MFC) FIND_PACKAGE(MFC) ENDIF(WITH_MFC) diff --git a/code/CMakeModules/FindWindowsSDK.cmake b/code/CMakeModules/FindWindowsSDK.cmake new file mode 100644 index 000000000..99c9e5518 --- /dev/null +++ b/code/CMakeModules/FindWindowsSDK.cmake @@ -0,0 +1,27 @@ +# - Find Windows Platform SDK +# Find the Windows includes +# +# WINSDK_INCLUDE_DIR - where to find Windows.h +# WINSDK_FOUND - True if Windows SDK found. + +IF(WINSDK_INCLUDE_DIR) + # Already in cache, be silent + SET(WINSDK_FIND_QUIETLY TRUE) +ENDIF(WINSDK_INCLUDE_DIR) + +FIND_PATH(WINSDK_INCLUDE_DIR Windows.h + PATHS + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include" + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]/Include" +) + +IF(WINSDK_INCLUDE_DIR) + SET(WINSDK_FOUND "YES") + IF(NOT WINSDK_FIND_QUIETLY) + MESSAGE(STATUS "Found Windows SDK.") + ENDIF(NOT WINSDK_FIND_QUIETLY) +ELSE(WINSDK_INCLUDE_DIR) + IF(NOT WINSDK_FIND_QUIETLY) + MESSAGE(STATUS "Warning: Unable to find Windows SDK!") + ENDIF(NOT WINSDK_FIND_QUIETLY) +ENDIF(WINSDK_INCLUDE_DIR)