[llvm] d6623d7 - [runtimes] Create Tests.cmake if it does not exist

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 00:51:45 PDT 2022


Author: Petr Hosek
Date: 2022-03-31T00:49:35-07:00
New Revision: d6623d72461b5a1ed3bd3ac966d14329e5b0f851

URL: https://github.com/llvm/llvm-project/commit/d6623d72461b5a1ed3bd3ac966d14329e5b0f851
DIFF: https://github.com/llvm/llvm-project/commit/d6623d72461b5a1ed3bd3ac966d14329e5b0f851.diff

LOG: [runtimes] Create Tests.cmake if it does not exist

This is necessary so that Tests.cmake is always included in the
generated build file and any changes made by subbuilds are detected
without needing to rerun CMake.

This is equivalent to an earlier version of D121647.

Differential Revision: https://reviews.llvm.org/D121647

Added: 
    

Modified: 
    llvm/runtimes/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/llvm/runtimes/CMakeLists.txt b/llvm/runtimes/CMakeLists.txt
index 9ee124a5616cc..f4c486924fb5b 100644
--- a/llvm/runtimes/CMakeLists.txt
+++ b/llvm/runtimes/CMakeLists.txt
@@ -220,7 +220,11 @@ function(runtime_default_target)
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)
-    include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake OPTIONAL)
+    if (NOT EXISTS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+      # This file will be later replaced by the runtimes subbuild.
+      file(TOUCH ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+    endif()
+    include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
     set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
     set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
     set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${SUB_LIT_PARAMS})
@@ -302,7 +306,11 @@ function(runtime_register_target name target)
   endforeach()
 
   if(LLVM_INCLUDE_TESTS)
-    include(${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake OPTIONAL)
+    if (NOT EXISTS ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+      # This file will be later replaced by the runtimes subbuild.
+      file(TOUCH ${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
+    endif()
+    include(${LLVM_BINARY_DIR}/runtimes/Tests.cmake)
     set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${LLVM_BINARY_DIR}/runtimes/${name}/Tests.cmake)
     set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${SUB_LIT_TESTSUITES})
     set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${SUB_LIT_PARAMS})


        


More information about the llvm-commits mailing list