diff --git a/CMakeLists.txt b/CMakeLists.txt index 6abf9fa97..7b26af2b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -223,19 +223,6 @@ CHECK_CXX_SOURCE_COMPILES("#include \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) diff --git a/cmake/FindDbgHelp.cmake b/cmake/FindDbgHelp.cmake index d10866a96..bf64c23b8 100644 --- a/cmake/FindDbgHelp.cmake +++ b/cmake/FindDbgHelp.cmake @@ -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})