[llvm] r279893 - [CMake] Only generate Components.cmake if components are specified

Chris Bieneman via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 26 17:19:51 PDT 2016


Author: cbieneman
Date: Fri Aug 26 19:19:51 2016
New Revision: 279893

URL: http://llvm.org/viewvc/llvm-project?rev=279893&view=rev
Log:
[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.

Modified:
    llvm/trunk/runtimes/CMakeLists.txt

Modified: llvm/trunk/runtimes/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/runtimes/CMakeLists.txt?rev=279893&r1=279892&r2=279893&view=diff
==============================================================================
--- llvm/trunk/runtimes/CMakeLists.txt (original)
+++ llvm/trunk/runtimes/CMakeLists.txt Fri Aug 26 19:19:51 2016
@@ -90,25 +90,27 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_
   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(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(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)




More information about the llvm-commits mailing list