[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
This commit is contained in:
Chris Bieneman 2016-08-27 00:19:51 +00:00
parent 28fa3c519c
commit bc3940e7ec
1 changed files with 19 additions and 17 deletions

View File

@ -90,25 +90,27 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
endif() endif()
get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS) get_property(SUB_COMPONENTS GLOBAL PROPERTY SUB_COMPONENTS)
list(REMOVE_DUPLICATES SUB_COMPONENTS) if(SUB_COMPONENTS)
foreach(component ${SUB_COMPONENTS}) list(REMOVE_DUPLICATES SUB_COMPONENTS)
if(NOT TARGET ${component}) foreach(component ${SUB_COMPONENTS})
message(SEND_ERROR "Missing target for runtime component ${component}!") if(NOT TARGET ${component})
continue() message(SEND_ERROR "Missing target for runtime component ${component}!")
endif() continue()
if(LLVM_INCLUDE_TESTS AND NOT TARGET check-${component}) endif()
message(SEND_ERROR "Missing check target for runtime component ${component}!") if(LLVM_INCLUDE_TESTS AND NOT TARGET check-${component})
continue() message(SEND_ERROR "Missing check target for runtime component ${component}!")
endif() continue()
endif()
if(TARGET install-${component}) if(TARGET install-${component})
list(APPEND SUB_INSTALL_TARGETS install-${component}) list(APPEND SUB_INSTALL_TARGETS install-${component})
endif() endif()
endforeach() endforeach()
configure_file( configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in ${CMAKE_CURRENT_SOURCE_DIR}/Components.cmake.in
${LLVM_BINARY_DIR}/runtimes/Components.cmake) ${LLVM_BINARY_DIR}/runtimes/Components.cmake)
endif()
else() # if this is included from LLVM's CMake else() # if this is included from LLVM's CMake
include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL) include(${LLVM_BINARY_DIR}/runtimes/Components.cmake OPTIONAL)