From d63a699e015ca09f2fbab1d917de98f62f950e5d Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sat, 23 Jul 2022 15:29:13 +0200 Subject: [PATCH] cmake: by default, disable install target when building SDL as a subproject --- CMakeLists.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fdbe9b138..27cecf1ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ endif() cmake_minimum_required(VERSION 3.0.0) project(SDL2 C CXX) +if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) + set(SDL2_SUBPROJECT OFF) +else() + set(SDL2_SUBPROJECT ON) +endif() + if (HAIKU) set(LINKER_LANGUAGE CXX) endif() @@ -414,7 +420,7 @@ endforeach() # Allow some projects to be built conditionally. set_option(SDL2_DISABLE_SDL2MAIN "Disable building/installation of SDL2main" OFF) -set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" OFF) +set_option(SDL2_DISABLE_INSTALL "Disable installation of SDL2" ${SDL2_SUBPROJECT}) set_option(SDL2_DISABLE_UNINSTALL "Disable uninstallation of SDL2" OFF) option_string(SDL_ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")