From aa8b5f1f2e3932b8269894c46108ce8d800aa99d Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Sun, 24 Apr 2022 11:14:52 +0200 Subject: [PATCH] Added a CMake flag for building as Flatpak. --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa4cef37d..d770a00af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils # Define the options. option(GL "Set to ON if targeting Desktop OpenGL 3.3" ${GL}) option(GLES "Set to ON if targeting OpenGL ES 3.0" ${GLES}) +option(FLATPAK_BUILD "Set to ON when building as a Flatpak" ${FLATPAK_BUILD}) option(STEAM_DECK "Set to ON to enable Valve Steam Deck specific build" ${STEAM_DECK}) option(RPI "Set to ON to enable Raspberry Pi specific build" ${RPI}) option(BUNDLED_CERTS "Set to ON to use bundled TLS/SSL certificates" ${BUNDLED_CERTS}) @@ -283,6 +284,12 @@ if(GLES) add_compile_definitions(USE_OPENGLES) endif() +# When building as a Flatpak, all launch commands will be prefixed by "flatpak-spawn --host". +if(FLATPAK_BUILD) + add_compile_definitions(FLATPAK_BUILD) + message("-- Building as a Flatpak") +endif() + if(STEAM_DECK) add_compile_definitions(STEAM_DECK) message("-- Building for the Valve Steam Deck")