Win32: Don't try to locate Windows SDK

MSVC already knows where the Windows SDK is located, so we don't have to
replicate that logic in CMake (then get it wrong and link to an outdated
one).
alut-include-path
Nicolas Hake 2017-03-05 11:56:45 +01:00
parent 1c7ee21903
commit 9bb3dd8877
2 changed files with 17 additions and 19 deletions

View File

@ -223,19 +223,6 @@ CHECK_CXX_SOURCE_COMPILES("#include <getopt.h>\nint main(int argc, char * argv[]
############################################################################
# Locate libraries
############################################################################
# Find win32 SDK, since a lot of users don't have the include path in their environment
if(MSVC)
get_filename_component(WINSDK_ROOT "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" ABSOLUTE CACHE)
mark_as_advanced(WINSDK_ROOT)
list(APPEND CMAKE_INCLUDE_PATH "${WINSDK_ROOT}/Include")
include_directories(SYSTEM ${WINSDK_ROOT}/Include)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
list(APPEND CMAKE_LIBRARY_PATH ${WINSDK_ROOT}/Lib/x64)
else()
list(APPEND CMAKE_LIBRARY_PATH ${WINSDK_ROOT}/Lib)
endif()
endif()
SET(JPEG_NAMES ${JPEG_NAMES} libjpeg jpeg-static)
if(NOT HEADLESS_ONLY)
find_package(Freetype REQUIRED)

View File

@ -1,6 +1,6 @@
# OpenClonk, http://www.openclonk.org
#
# Copyright (c) 2011-2016, The OpenClonk Team and contributors
# Copyright (c) 2011-2017, The OpenClonk Team and contributors
#
# Distributed under the terms of the ISC license; see accompanying file
# "COPYING" for details.
@ -18,12 +18,23 @@
# DBGHELP_LIBRARIES, the libraries needed to use DbgHelp.
# DBGHELP_FOUND, If false, do not try to use DbgHelp.
find_path(DBGHELP_INCLUDE_DIR NAMES dbghelp.h PATH_SUFFIXES include)
set(DBGHELP_NAMES ${DBGHELP_NAMES} dbghelp)
find_library(DBGHELP_LIBRARY NAMES ${DBGHELP_NAMES})
# MSVC knows how to find the Windows SDK on its own, and replicating that
# in CMake is very tricky, especially with the SDK's layout changing
# occasionally. So instead we'll just leave it to MSVC to do correctly.
if(MSVC AND NOT DEFINED DBGHELP_INCLUDE_DIR AND NOT DEFINED DBGHELP_LIBRARY)
set(DBGHELP_INCLUDE_DIR "")
set(DBGHELP_LIBRARY "dbghelp")
set(DBGHELP_FOUND TRUE)
endif()
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBGHELP DEFAULT_MSG DBGHELP_LIBRARY DBGHELP_INCLUDE_DIR)
if(NOT DBGHELP_FOUND)
find_path(DBGHELP_INCLUDE_DIR NAMES dbghelp.h PATH_SUFFIXES include)
set(DBGHELP_NAMES ${DBGHELP_NAMES} dbghelp)
find_library(DBGHELP_LIBRARY NAMES ${DBGHELP_NAMES})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(DBGHELP DEFAULT_MSG DBGHELP_LIBRARY DBGHELP_INCLUDE_DIR)
endif()
if(DBGHELP_FOUND)
set(DBGHELP_LIBRARIES ${DBGHELP_LIBRARY})