deps-windows.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. # https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
  2. if (MSVC_VERSION EQUAL 1800)
  3. # 1800 = VS 12.0 (v120 toolset)
  4. set(DEP_VS_VER "12")
  5. set(DEP_BOOST_TOOLSET "msvc-12.0")
  6. elseif (MSVC_VERSION EQUAL 1900)
  7. # 1900 = VS 14.0 (v140 toolset)
  8. set(DEP_VS_VER "14")
  9. set(DEP_BOOST_TOOLSET "msvc-14.0")
  10. elseif (MSVC_VERSION LESS 1920)
  11. # 1910-1919 = VS 15.0 (v141 toolset)
  12. set(DEP_VS_VER "15")
  13. set(DEP_BOOST_TOOLSET "msvc-14.1")
  14. elseif (MSVC_VERSION LESS 1930)
  15. # 1920-1929 = VS 16.0 (v142 toolset)
  16. set(DEP_VS_VER "16")
  17. set(DEP_BOOST_TOOLSET "msvc-14.2")
  18. else ()
  19. message(FATAL_ERROR "Unsupported MSVC version")
  20. endif ()
  21. if (CMAKE_CXX_COMPILER_ID STREQUAL Clang)
  22. set(DEP_BOOST_TOOLSET "clang-win")
  23. endif ()
  24. if (${DEPS_BITS} EQUAL 32)
  25. set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
  26. set(DEP_PLATFORM "Win32")
  27. else ()
  28. if (DEP_VS_VER LESS 16)
  29. set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER} Win64")
  30. else ()
  31. set(DEP_MSVC_GEN "Visual Studio ${DEP_VS_VER}")
  32. endif ()
  33. set(DEP_PLATFORM "x64")
  34. endif ()
  35. if (${DEP_DEBUG})
  36. set(DEP_BOOST_DEBUG "debug")
  37. else ()
  38. set(DEP_BOOST_DEBUG "")
  39. endif ()
  40. macro(add_debug_dep _dep)
  41. if (${DEP_DEBUG})
  42. ExternalProject_Get_Property(${_dep} BINARY_DIR)
  43. ExternalProject_Add_Step(${_dep} build_debug
  44. DEPENDEES build
  45. DEPENDERS install
  46. COMMAND msbuild /m /P:Configuration=Debug INSTALL.vcxproj
  47. WORKING_DIRECTORY "${BINARY_DIR}"
  48. )
  49. endif ()
  50. endmacro()
  51. if (${DEPS_BITS} EQUAL 32)
  52. set(DEP_WXWIDGETS_TARGET "")
  53. set(DEP_WXWIDGETS_LIBDIR "vc_lib")
  54. else ()
  55. set(DEP_WXWIDGETS_TARGET "TARGET_CPU=X64")
  56. set(DEP_WXWIDGETS_LIBDIR "vc_x64_lib")
  57. endif ()
  58. find_package(Git REQUIRED)