diff --git a/flang/CMakeLists.txt b/flang/CMakeLists.txt --- a/flang/CMakeLists.txt +++ b/flang/CMakeLists.txt @@ -392,6 +392,9 @@ add_subdirectory(runtime) option(FLANG_BUILD_EXAMPLES "Build Flang example programs by default." OFF) +if (FLANG_BUILD_EXAMPLES AND FLANG_STANDALONE_BUILD) + message(FATAL_ERROR "Examples are not supported in out-of-tree builds.") +endif() add_subdirectory(examples) if (FLANG_INCLUDE_TESTS) diff --git a/flang/test/CMakeLists.txt b/flang/test/CMakeLists.txt --- a/flang/test/CMakeLists.txt +++ b/flang/test/CMakeLists.txt @@ -9,13 +9,23 @@ set(FLANG_TOOLS_DIR ${FLANG_BINARY_DIR}/bin) +# FIXME In out-of-tree builds, "SHLIBDIR" is undefined and passing it to +# `configure_lit_site_cfg` leads to a configuration error. This is currently +# only required by plugins/examples, which are not supported in out-of-tree +# builds. +if (FLANG_STANDALONE_BUILD) + set(PATHS_FOR_PLUGINS "") +else () + set(PATHS_FOR_PLUGINS "SHLIBDIR") +endif () + configure_lit_site_cfg( ${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in ${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py MAIN_CONFIG ${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py PATHS - "SHLIBDIR" + ${PATHS_FOR_PLUGINS} ) configure_lit_site_cfg(