Skip to content

Commit cedee3b

Browse files
authored
Project project_BUILD_* variables (#23)
1 parent 93de50b commit cedee3b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

SwiftCmakeOptions.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,15 @@ function(swift_create_project_options)
164164
set(x_PROJECT ${PROJECT_NAME})
165165
endif()
166166

167+
if(NOT ${x_PROJECT}_BUILD_VARS_PROTECTED)
168+
foreach(feat "TESTS" "TEST_LIBS" "EXAMPLES" "DOCS")
169+
if(DEFINED ${x_PROJECT}_BUILD_${feat})
170+
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.")
171+
endif()
172+
endforeach()
173+
set(${x_PROJECT}_BUILD_VARS_PROTECTED ON CACHE BOOL "Checked that nothing has set any BUILD vars manually")
174+
endif()
175+
167176
set(tests_possible ON)
168177
set(test_libs_possible ON)
169178
if(x_DISABLE_TEST_COMPONENTS)

0 commit comments

Comments
 (0)