[libc-commits] [libc] 2c3723d - [libc] Correctly pass the C++ standard to NVPTX internal builds

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri Jun 7 05:55:18 PDT 2024


Author: Joseph Huber
Date: 2024-06-07T07:55:06-05:00
New Revision: 2c3723d321ae000dfc9dfab064076799a90c322e

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

LOG: [libc] Correctly pass the C++ standard to NVPTX internal builds

Summary:
The NVPTX build wasn't getting the `C++20` standard necessary for a few
files.

Added: 
    

Modified: 
    libc/cmake/modules/LLVMLibCObjectRules.cmake

Removed: 
    


################################################################################
diff  --git a/libc/cmake/modules/LLVMLibCObjectRules.cmake b/libc/cmake/modules/LLVMLibCObjectRules.cmake
index 134c5143d6d61..1f80e7f4e57c1 100644
--- a/libc/cmake/modules/LLVMLibCObjectRules.cmake
+++ b/libc/cmake/modules/LLVMLibCObjectRules.cmake
@@ -44,6 +44,10 @@ function(create_object_library fq_target_name)
     message(FATAL_ERROR "'add_object_library' rule requires SRCS to be specified.")
   endif()
 
+  if(NOT ADD_OBJECT_CXX_STANDARD)
+    set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
+  endif()
+
   set(internal_target_name ${fq_target_name}.__internal__)
   set(public_packaging_for_internal "-DLIBC_COPT_PUBLIC_PACKAGING")
 
@@ -75,6 +79,9 @@ function(create_object_library fq_target_name)
     target_include_directories(${internal_target_name} PRIVATE ${LIBC_SOURCE_DIR})
     target_compile_options(${internal_target_name} PRIVATE ${compile_options}
                            -fno-lto -march=${LIBC_GPU_TARGET_ARCHITECTURE})
+    set_target_properties(${internal_target_name}
+                          PROPERTIES
+                          CXX_STANDARD ${ADD_OBJECT_CXX_STANDARD})
   endif()
 
   if(SHOW_INTERMEDIATE_OBJECTS)
@@ -92,9 +99,6 @@ function(create_object_library fq_target_name)
     target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})
   endif()
 
-  if(NOT ADD_OBJECT_CXX_STANDARD)
-    set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
-  endif()
   set_target_properties(
     ${fq_target_name}
     PROPERTIES


        


More information about the libc-commits mailing list