From 91b6305dcd057faaa922e8ed645b732410ce2a92 Mon Sep 17 00:00:00 2001 From: Maarten Bent Date: Wed, 12 Dec 2018 20:41:37 +0100 Subject: [PATCH] CMake: Improve checking for external libraries Do not abort when libLZMA or libSecret can not be found, just show a warning. Do not search for libSecret on macOS. Disable libraries internally (not in cache) when not searching for them. --- build/cmake/init.cmake | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake index 9738f69859..2d67e48c90 100644 --- a/build/cmake/init.cmake +++ b/build/cmake/init.cmake @@ -151,14 +151,18 @@ if(wxUSE_THREADS) endif() if(wxUSE_LIBLZMA) - find_package(LibLZMA REQUIRED) + find_package(LibLZMA) + if(NOT LIBLZMA_FOUND) + message(WARNING "libLZMA not found, LZMA compression won't be available") + wx_option_force_value(wxUSE_LIBLZMA OFF) + endif() endif() if(UNIX) - if(wxUSE_SECRETSTORE) + if(wxUSE_SECRETSTORE AND NOT APPLE) # The required APIs are always available under MSW and OS X but we must # have GNOME libsecret under Unix to be able to compile this class. - find_package(Libsecret REQUIRED) + find_package(Libsecret) if(NOT LIBSECRET_FOUND) message(WARNING "libsecret not found, wxSecretStore won't be available") wx_option_force_value(wxUSE_SECRETSTORE OFF) @@ -293,9 +297,12 @@ if(wxUSE_GUI) message(WARNING "GStreamer not found, wxMediaCtrl won't be available") wx_option_force_value(wxUSE_MEDIACTRL OFF) endif() + else() + set(wxUSE_GSTREAMER OFF) + set(wxUSE_GSTREAMER_PLAYER OFF) endif() - if(UNIX AND wxUSE_LIBSDL) + if(wxUSE_SOUND AND UNIX AND wxUSE_LIBSDL) find_package(SDL2) if(NOT SDL2_FOUND) find_package(SDL) @@ -304,6 +311,8 @@ if(wxUSE_GUI) message(WARNING "SDL not found, SDL Audio back-end won't be available") wx_option_force_value(wxUSE_LIBSDL OFF) endif() + else() + set(wxUSE_LIBSDL OFF) endif() if(wxUSE_NOTIFICATION_MESSAGE AND UNIX AND WXGTK2 AND wxUSE_LIBNOTIFY) @@ -314,6 +323,8 @@ if(wxUSE_GUI) elseif((LIBNOTIFY_VERSION GREATER 0.7) OR (LIBNOTIFY_VERSION EQUAL 0.7)) set(wxUSE_LIBNOTIFY_0_7 ON) endif() + else() + set(wxUSE_LIBNOTIFY OFF) endif() if(wxUSE_UIACTIONSIMULATOR AND UNIX AND WXGTK) @@ -346,6 +357,8 @@ if(wxUSE_GUI) message(STATUS "libmspack not found") wx_option_force_value(wxUSE_LIBMSPACK OFF) endif() + else() + set(wxUSE_LIBMSPACK OFF) endif() if(WXGTK2 AND wxUSE_MIMETYPE AND wxUSE_LIBGNOMEVFS) @@ -357,5 +370,7 @@ if(wxUSE_GUI) message(STATUS "libgnomevfs not found, library won't be used to associate MIME type") wx_option_force_value(wxUSE_LIBGNOMEVFS OFF) endif() + else() + set(wxUSE_LIBGNOMEVFS OFF) endif() endif()