[libclc] [libclc] Fix build with Unix Makefiles (PR #89147)

Fraser Cormack via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 17 23:03:38 PDT 2024


https://github.com/frasercrmck updated https://github.com/llvm/llvm-project/pull/89147

>From 0f102a202e4a80fbc106303df5005a2b7922b0cf Mon Sep 17 00:00:00 2001
From: Fraser Cormack <fraser at codeplay.com>
Date: Wed, 17 Apr 2024 22:28:03 +0100
Subject: [PATCH] [libclc] Fix build with Unix Makefiles

Commit #87622 broke the build. Ninja was happy with creating the output
directories as necessary, but Unix Makefiles isn't. Ensure they are
always created.

Fixes #88626.
---
 libclc/cmake/modules/AddLibclc.cmake | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libclc/cmake/modules/AddLibclc.cmake b/libclc/cmake/modules/AddLibclc.cmake
index 5e09cde8035c27..bbedc244a72899 100644
--- a/libclc/cmake/modules/AddLibclc.cmake
+++ b/libclc/cmake/modules/AddLibclc.cmake
@@ -39,6 +39,10 @@ function(compile_to_bc)
     set( TARGET_ARG "-target" ${ARG_TRIPLE} )
   endif()
 
+  # Ensure the directory we are told to output to exists
+  get_filename_component( ARG_OUTPUT_DIR ${ARG_OUTPUT} DIRECTORY )
+  file( MAKE_DIRECTORY ${ARG_OUTPUT_DIR} )
+
   add_custom_command(
     OUTPUT ${ARG_OUTPUT}${TMP_SUFFIX}
     COMMAND libclc::clang



More information about the cfe-commits mailing list