From 54e98f9537a8b251fb60f55ca0c964bfa9537f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 25 Dec 2016 13:25:11 +0100 Subject: [PATCH] CMake: better implicit behavior for WITH_WINDOWLESS{EGL,GLX}APPLICATION. I found a way how to hack cmake_dependent_option() beyond just specifying a list of things AND-ed togeter -- if one uses spaces instead of `;`, all the contents are passed to a single if() statement and it's possible to use parentheses, AND, OR and all other stuff. Now, WindowlessEglApplication is implicitly enabled if targeting non-desktop ES and magnum-info utility is enabled, because magnum-info depends on it in that case. In all other cases it is implicitly disabled with ability to enable it. WindowlessGlxApplication is now available only when targeting desktop GL or desktop GLES and is implicitly enabled when magnum-info or any other GL utility is enabled. --- CMakeLists.txt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 01ca71250..e0103e199 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,8 +93,8 @@ cmake_dependent_option(WITH_AL_INFO "Build magnum-al-info utility" OFF "WITH_AUD # EGL context and windowless EGL application, available everywhere except on # platforms which don't support extension loading if(NOT CORRADE_TARGET_EMSCRIPTEN AND NOT CORRADE_TARGET_NACL) + cmake_dependent_option(WITH_WINDOWLESSEGLAPPLICATION "Build WindowlessEglApplication library" OFF "NOT TARGET_GLES OR TARGET_DESKTOP_GLES OR NOT WITH_MAGNUMINFO" ON) option(WITH_EGLCONTEXT "Build EglContext library" OFF) - option(WITH_WINDOWLESSEGLAPPLICATION "Build WindowlessEglApplication library" OFF) endif() # NaCl-specific application libraries @@ -118,9 +118,11 @@ elseif(CORRADE_TARGET_APPLE) # X11 + GLX/EGL-specific application libraries elseif(CORRADE_TARGET_UNIX) option(WITH_GLXAPPLICATION "Build GlxApplication library" OFF) - cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) + if(NOT TARGET_GLES OR TARGET_DESKTOP_GLES) + cmake_dependent_option(WITH_WINDOWLESSGLXAPPLICATION "Build WindowlessGlxApplication library" OFF "NOT WITH_MAGNUMINFO;NOT WITH_FONTCONVERTER;NOT WITH_DISTANCEFIELDCONVERTER" ON) + option(WITH_GLXCONTEXT "Build GlxContext library" OFF) + endif() option(WITH_XEGLAPPLICATION "Build XEglApplication library" OFF) - option(WITH_GLXCONTEXT "Build GlxContext library" OFF) # Windows-specific application libraries elseif(CORRADE_TARGET_WINDOWS)