File tree Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Expand file tree Collapse file tree 2 files changed +49
-2
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,9 @@ function(llvmir_attach_bc_target OUT_TRGT IN_TRGT)
56
56
# includes
57
57
llvmir_extract_include_dirs_properties (IN_INCLUDES ${IN_TRGT} )
58
58
59
+ # language standards flags
60
+ llvmir_extract_standard_flags (IN_STANDARD_FLAGS ${IN_TRGT} )
61
+
59
62
# compile options
60
63
llvmir_extract_compile_option_properties (IN_COMPILE_OPTIONS ${IN_TRGT} )
61
64
@@ -86,8 +89,9 @@ function(llvmir_attach_bc_target OUT_TRGT IN_TRGT)
86
89
debug ("@llvmir_attach_bc_target ${IN_TRGT} compile flags: \
87
90
${CURRENT_COMPILE_FLAGS} " )
88
91
89
- set (CMD_ARGS "-emit-llvm" ${IN_LANG_FLAGS} ${IN_COMPILE_OPTIONS}
90
- ${CURRENT_COMPILE_FLAGS} ${CURRENT_DEFS} ${IN_INCLUDES} )
92
+ set (CMD_ARGS "-emit-llvm" ${IN_STANDARD_FLAGS} ${IN_LANG_FLAGS}
93
+ ${IN_COMPILE_OPTIONS} ${CURRENT_COMPILE_FLAGS} ${CURRENT_DEFS}
94
+ ${IN_INCLUDES} )
91
95
92
96
add_custom_command (OUTPUT ${FULL_OUT_LLVMIR_FILE}
93
97
COMMAND ${LLVMIR_COMPILER}
Original file line number Diff line number Diff line change @@ -244,6 +244,49 @@ function(llvmir_extract_lang_flags out_lang_flags lang)
244
244
endfunction ()
245
245
246
246
247
+ function (llvmir_extract_standard_flags out_standard_flags trgt )
248
+ set (standard_flags "" )
249
+
250
+ get_property (std TARGET ${trgt} PROPERTY C_STANDARD )
251
+ get_property (req TARGET ${trgt} PROPERTY C_EXTENSIONS )
252
+
253
+ if (std )
254
+ if (req )
255
+ set (cflag "gnu" )
256
+ else ()
257
+ set (cflag "std" )
258
+ endif ()
259
+
260
+ set (cflag "${flag} c${std} " )
261
+ endif ()
262
+
263
+ get_property (std TARGET ${trgt} PROPERTY CXX_STANDARD )
264
+ get_property (req TARGET ${trgt} PROPERTY CXX_EXTENSIONS )
265
+
266
+ if (std )
267
+ if (req )
268
+ set (cxxflag "gnu" )
269
+ else ()
270
+ set (cxxflag "std" )
271
+ endif ()
272
+
273
+ set (cxxflag "${flag} c++${std} " )
274
+ endif ()
275
+
276
+ if (cflag )
277
+ set (standard_flags "-std=${cflag} " )
278
+ endif ()
279
+
280
+ if (cxxflag )
281
+ set (standard_flags "-std=${cxxflag} " )
282
+ endif ()
283
+
284
+ debug ("@llvmir_extract_standard_flags ${lang} : ${standard_flags} " )
285
+
286
+ set (${out_standard_flags} ${standard_flags} PARENT_SCOPE )
287
+ endfunction ()
288
+
289
+
247
290
function (llvmir_extract_compile_flags out_compile_flags from )
248
291
#message(DEPRECATION "COMPILE_FLAGS property is deprecated.")
249
292
You can’t perform that action at this time.
0 commit comments