From 8b9c1da2d445879817e18db3bd5b806bf073215e Mon Sep 17 00:00:00 2001 From: Matt Woodward Date: Wed, 11 Sep 2019 11:34:17 +1000 Subject: [PATCH] Project project_BUILD_* variables --- SwiftCmakeOptions.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/SwiftCmakeOptions.cmake b/SwiftCmakeOptions.cmake index 06bf45b..8241065 100644 --- a/SwiftCmakeOptions.cmake +++ b/SwiftCmakeOptions.cmake @@ -164,6 +164,15 @@ function(swift_create_project_options) set(x_PROJECT ${PROJECT_NAME}) endif() + if(NOT ${x_PROJECT}_BUILD_VARS_PROTECTED) + foreach(feat "TESTS" "TEST_LIBS" "EXAMPLES" "DOCS") + if(DEFINED ${x_PROJECT}_BUILD_${feat}) + message(FATAL_ERROR "Something or someone has set ${x_PROJECT}_BUILD_${feat}. This is an internal option and must not be set from anywhere. Use ${x_PROJECT}_ENABLE_${feat} instead.") + endif() + endforeach() + set(${x_PROJECT}_BUILD_VARS_PROTECTED ON CACHE BOOL "Checked that nothing has set any BUILD vars manually") + endif() + set(tests_possible ON) set(test_libs_possible ON) if(x_DISABLE_TEST_COMPONENTS)