[cmake] Put check from D110016 behind (default-on) flag

See discussion on https://reviews.llvm.org/D110016 for details.
This commit is contained in:
Nico Weber 2021-09-20 15:06:00 -04:00
parent a95ba81073
commit 55f0b33708

View File

@ -71,11 +71,15 @@ set(LLVM_EXTRA_PROJECTS "flang")
set(LLVM_KNOWN_PROJECTS "${LLVM_ALL_PROJECTS};${LLVM_EXTRA_PROJECTS}")
set(LLVM_ENABLE_PROJECTS "" CACHE STRING
"Semicolon-separated list of projects to build (${LLVM_KNOWN_PROJECTS}), or \"all\".")
foreach(proj ${LLVM_ENABLE_PROJECTS})
if (NOT proj STREQUAL "all" AND NOT proj STREQUAL "llvm" AND NOT "${proj}" IN_LIST LLVM_KNOWN_PROJECTS)
MESSAGE(FATAL_ERROR "${proj} isn't a known project: ${LLVM_KNOWN_PROJECTS}")
endif()
endforeach()
option(LLVM_CHECK_ENABLED_PROJECTS "Whether to check LLVM_ENABLE_PROJECTS" ON)
if (LLVM_CHECK_ENABLED_PROJECTS)
foreach(proj ${LLVM_ENABLE_PROJECTS})
if (NOT proj STREQUAL "all" AND NOT proj STREQUAL "llvm" AND NOT "${proj}" IN_LIST LLVM_KNOWN_PROJECTS)
MESSAGE(FATAL_ERROR "${proj} isn't a known project: ${LLVM_KNOWN_PROJECTS}")
endif()
endforeach()
endif()
if( LLVM_ENABLE_PROJECTS STREQUAL "all" )
set( LLVM_ENABLE_PROJECTS ${LLVM_ALL_PROJECTS})