Skip to content

Commit 2c3723d

Browse files
committed
[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.
1 parent 913a824 commit 2c3723d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

libc/cmake/modules/LLVMLibCObjectRules.cmake

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ function(create_object_library fq_target_name)
4444
message(FATAL_ERROR "'add_object_library' rule requires SRCS to be specified.")
4545
endif()
4646

47+
if(NOT ADD_OBJECT_CXX_STANDARD)
48+
set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
49+
endif()
50+
4751
set(internal_target_name ${fq_target_name}.__internal__)
4852
set(public_packaging_for_internal "-DLIBC_COPT_PUBLIC_PACKAGING")
4953

@@ -75,6 +79,9 @@ function(create_object_library fq_target_name)
7579
target_include_directories(${internal_target_name} PRIVATE ${LIBC_SOURCE_DIR})
7680
target_compile_options(${internal_target_name} PRIVATE ${compile_options}
7781
-fno-lto -march=${LIBC_GPU_TARGET_ARCHITECTURE})
82+
set_target_properties(${internal_target_name}
83+
PROPERTIES
84+
CXX_STANDARD ${ADD_OBJECT_CXX_STANDARD})
7885
endif()
7986

8087
if(SHOW_INTERMEDIATE_OBJECTS)
@@ -92,9 +99,6 @@ function(create_object_library fq_target_name)
9299
target_link_libraries(${fq_target_name} PUBLIC ${fq_deps_list})
93100
endif()
94101

95-
if(NOT ADD_OBJECT_CXX_STANDARD)
96-
set(ADD_OBJECT_CXX_STANDARD ${CMAKE_CXX_STANDARD})
97-
endif()
98102
set_target_properties(
99103
${fq_target_name}
100104
PROPERTIES

0 commit comments

Comments
 (0)