From bc3940e7ec60355b23b0bd85621923ba2ab5506b Mon Sep 17 00:00:00 2001 From: Chris Bieneman Date: Sat, 27 Aug 2016 00:19:51 +0000 Subject: [PATCH] [CMake] Only generate Components.cmake if components are specified Generating the Components import file is useless if there are no components coming in from the runtimes configuration, so we should skip generation in that case. This also should fix the configuration error that Renato reported on llvm-dev. llvm-svn: 279893 --- llvm/runtimes/CMakeLists.txt | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt index 139f603..4d07476 100644 --- a/llvm/runtimes/CMakeLists.txt +++ b/llvm/runtimes/CMakeLists.txt @@ -90,25 +90,27 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR}) endif() get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS) - list(REMOVE_DUPLICATES SUB_COMPONENTS) - foreach(component ${SUB_COMPONENTS}) - if(NOT TARGET ${component}) - message(SEND_ERROR "Missing target for runtime component ${component}!") - continue() - endif() - if(LLVM_INCLUDE_TESTS AND NOT TARGET check-${component}) - message(SEND_ERROR "Missing check target for runtime component ${component}!") - continue() - endif() - - if(TARGET install-${component}) - list(APPEND SUB_INSTALL_TARGETS install-${component}) - endif() - endforeach() + if(SUB_COMPONENTS) + list(REMOVE_DUPLICATES SUB_COMPONENTS) + foreach(component ${SUB_COMPONENTS}) + if(NOT TARGET ${component}) + message(SEND_ERROR "Missing target for runtime component ${component}!") + continue() + endif() + if(LLVM_INCLUDE_TESTS AND NOT TARGET check-${component}) + message(SEND_ERROR "Missing check target for runtime component ${component}!") + continue() + endif() + + if(TARGET install-${component}) + list(APPEND SUB_INSTALL_TARGETS install-${component}) + endif() + endforeach() - configure_file( - ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in - ${LLVM_BINARY_DIR}/runtimes/Components.cmake) + configure_file( + ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in + ${LLVM_BINARY_DIR}/runtimes/Components.cmake) + endif() else() # if this is included from LLVM's CMake include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL) -- 2.7.4