From a9aa508c1af4b43050f14494a852790ab398747a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20D=C3=B6rfelt?= Date: Wed, 30 Oct 2024 09:37:49 -0700 Subject: [PATCH] CMake: Added VUL_ENABLE_INSTALL to top level cmake file. - Allows you to manually control the existance of the install target - defaults to VUL_IS_TOP_LEVEL to keep the original behavior without any changes to client code --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 674dcfe..dd34785 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,6 +9,11 @@ project(VUL LANGUAGES CXX) string(COMPARE EQUAL ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR} VUL_IS_TOP_LEVEL) # Remove when min is 3.21 +# Control whether to install or not. By default its only on if this is the top level cmake project. +if(NOT DEFINED VUL_ENABLE_INSTALL) + option(VUL_ENABLE_INSTALL "Enable install" ${VUL_IS_TOP_LEVEL}) +endif() + set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Remove when min is 3.26, see CMP0143 set(CMAKE_CXX_STANDARD 17) @@ -30,7 +35,7 @@ find_package(VulkanHeaders CONFIG) add_subdirectory(src) add_subdirectory(include) -if (VUL_IS_TOP_LEVEL) +if (VUL_ENABLE_INSTALL) option(BUILD_TESTS "Build tests") if (BUILD_TESTS) enable_testing()