Skip to content

Commit

Permalink
Use CMakeDependentOption for dependent options
Browse files Browse the repository at this point in the history
This replaces the earlier manual logic for dependent CMake options with
the cmake_dependent_option function from CMakeDependentOption.
  • Loading branch information
elmindreda committed May 17, 2019
1 parent a255e7a commit cd290f7
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

include(GNUInstallDirs)

if (UNIX)
option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF)
endif()

if (WIN32)
option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF)
endif()

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()
include(CMakeDependentOption)

cmake_dependent_option(GLFW_USE_OSMESA "Use OSMesa for offscreen context creation" OFF
"UNIX" OFF)
cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
"WIN32" OFF)
cmake_dependent_option(GLFW_USE_WAYLAND "Use Wayland for window creation" OFF
"UNIX;NOT APPLE" OFF)
cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
"MSVC" OFF)

if (BUILD_SHARED_LIBS)
set(_GLFW_BUILD_DLL 1)
Expand Down

0 comments on commit cd290f7

Please sign in to comment.