Use CMakeDependentOption for dependent options

This replaces the earlier manual logic for dependent CMake options with
the cmake_dependent_option function from CMakeDependentOption.

(cherry picked from commit cd290f767f)
This commit is contained in:
Camilla Löwy 2019-05-08 18:33:28 +02:00
parent bc8b567d7c
commit b596c79014

View File

@ -18,22 +18,16 @@ option(GLFW_INSTALL "Generate installation target" ON)
option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF) option(GLFW_VULKAN_STATIC "Assume the Vulkan loader is linked with the application" OFF)
include(GNUInstallDirs) include(GNUInstallDirs)
include(CMakeDependentOption)
if (UNIX) cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF
option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF) "UNIX" OFF)
endif() cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
"WIN32" OFF)
if (WIN32) cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF) "UNIX;NOT APPLE" OFF)
endif() cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
"MSVC" OFF)
if (UNIX AND NOT APPLE)
option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF)
endif()
if (MSVC)
option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON)
endif()
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
set(_GLFW_BUILD_DLL 1) set(_GLFW_BUILD_DLL 1)