Procházet zdrojové kódy

CMake: Conditionally turn on bundled libs for MSVC

Removes the annoying step when generating sln for MSVC where you have to
click an extra checkbox after the first generate fails by using a
conditional option. The USE_BUNDLED options will be off by default, but
if the enable_lib option is enabled and the toolset is msvc, they are
turned ON.
James Rowe před 8 roky
rodič
revize
1e662e6e9a
1 změnil soubory, kde provedl 5 přidání a 2 odebrání
  1. 5 2
      CMakeLists.txt

+ 5 - 2
CMakeLists.txt

@@ -3,14 +3,17 @@ cmake_minimum_required(VERSION 3.6)
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules")
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/externals/cmake-modules")
 include(DownloadExternals)
+include(CMakeDependentOption)
 
 project(yuzu)
 
+# Set bundled sdl2/qt as dependent options.
+# OFF by default, but if ENABLE_SDL2 and MSVC are true then ON
 option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
-option(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" OFF)
+CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF)
 
 option(ENABLE_QT "Enable the Qt frontend" ON)
-option(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" OFF)
+CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_SDL2;MSVC" OFF)
 
 if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/pre-commit)
     message(STATUS "Copying pre-commit hook")