Skip to content

Commit b37a44f

Browse files
committed
Fix CMake build
Created using spr 1.3.6-beta.1
1 parent 84a0613 commit b37a44f

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

compiler-rt/cmake/Modules/AddCompilerRT.cmake

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ function(add_compiler_rt_runtime name type)
172172
cmake_parse_arguments(LIB
173173
""
174174
"PARENT_TARGET"
175-
"OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS;EXTENSIONS"
175+
"OS;ARCHS;SOURCES;CFLAGS;LINK_FLAGS;DEFS;DEPS;LINK_LIBS;OBJECT_LIBS;ADDITIONAL_HEADERS;EXTENSIONS;C_STANDARD;CXX_STANDARD"
176176
${ARGN})
177177
set(libnames)
178178
# Until we support this some other way, build compiler-rt runtime without LTO
@@ -360,6 +360,12 @@ function(add_compiler_rt_runtime name type)
360360
set_target_link_flags(${libname} ${extra_link_flags_${libname}})
361361
set_property(TARGET ${libname} APPEND PROPERTY
362362
COMPILE_DEFINITIONS ${LIB_DEFS})
363+
if(LIB_C_STANDARD)
364+
set_property(TARGET ${libname} PROPERTY C_STANDARD ${LIB_C_STANDARD})
365+
endif()
366+
if(LIB_CXX_STANDARD)
367+
set_property(TARGET ${libname} PROPERTY CXX_STANDARD ${LIB_CXX_STANDARD})
368+
endif()
363369
set_target_output_directories(${libname} ${output_dir_${libname}})
364370
install(TARGETS ${libname}
365371
ARCHIVE DESTINATION ${install_dir_${libname}}

compiler-rt/cmake/builtin-config-ix.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ builtin_check_c_compiler_flag("-Xclang -mcode-object-version=none" COMPILER_RT_H
2626
builtin_check_c_compiler_flag(-Wbuiltin-declaration-mismatch COMPILER_RT_HAS_WBUILTIN_DECLARATION_MISMATCH_FLAG)
2727
builtin_check_c_compiler_flag(/Zl COMPILER_RT_HAS_ZL_FLAG)
2828
builtin_check_c_compiler_flag(-fcf-protection=full COMPILER_RT_HAS_FCF_PROTECTION_FLAG)
29+
builtin_check_c_compiler_flag(-nostdinc++ COMPILER_RT_HAS_NOSTDINCXX_FLAG)
2930

3031
builtin_check_c_compiler_source(COMPILER_RT_HAS_ATOMIC_KEYWORD
3132
"

compiler-rt/lib/builtins/CMakeLists.txt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
66
cmake_minimum_required(VERSION 3.20.0)
77

88
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
9-
project(CompilerRTBuiltins C ASM)
9+
project(CompilerRTBuiltins C CXX ASM)
1010
set(COMPILER_RT_STANDALONE_BUILD TRUE)
1111
set(COMPILER_RT_BUILTINS_STANDALONE_BUILD TRUE)
1212

@@ -64,6 +64,8 @@ include(CMakePushCheckState)
6464
option(COMPILER_RT_BUILTINS_HIDE_SYMBOLS
6565
"Do not export any symbols from the static library." ON)
6666

67+
include_directories(../../../third-party/siphash/include)
68+
6769
# TODO: Need to add a mechanism for logging errors when builtin source files are
6870
# added to a sub-directory and not this CMakeLists file.
6971
set(GENERIC_SOURCES
@@ -803,7 +805,7 @@ else ()
803805
append_list_if(COMPILER_RT_ENABLE_CET -fcf-protection=full BUILTIN_CFLAGS)
804806
endif()
805807

806-
append_list_if(COMPILER_RT_HAS_STD_C11_FLAG -std=c11 BUILTIN_CFLAGS)
808+
append_list_if(COMPILER_RT_HAS_NOSTDINCXX_FLAG -nostdinc++ BUILTIN_CFLAGS)
807809
append_list_if(COMPILER_RT_HAS_WBUILTIN_DECLARATION_MISMATCH_FLAG -Werror=builtin-declaration-mismatch BUILTIN_CFLAGS)
808810

809811
# Don't embed directives for picking any specific CRT
@@ -918,6 +920,8 @@ else ()
918920
SOURCES ${${arch}_SOURCES}
919921
DEFS ${BUILTIN_DEFS}
920922
CFLAGS ${BUILTIN_CFLAGS_${arch}}
923+
C_STANDARD 11
924+
CXX_STANDARD 17
921925
PARENT_TARGET builtins)
922926
cmake_pop_check_state()
923927
endif ()

0 commit comments

Comments
 (0)