@@ -318,6 +318,7 @@ if (NOT WIN32)
318
318
add_flangrt_library (flang_rt.intrinsics OBJECT
319
319
${intrinsics_sources}
320
320
)
321
+ flang_module_target (flang_rt.intrinsics )
321
322
322
323
add_flangrt_library (flang_rt.runtime STATIC SHARED
323
324
${sources}
@@ -336,6 +337,8 @@ if (NOT WIN32)
336
337
Fortran_BUILDING_INSTRINSIC_MODULES TRUE
337
338
)
338
339
340
+
341
+
339
342
# TODO: shared (or global)
340
343
#target_compile_options(flang_rt.runtime.static PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:SHELL:-fintrinsic-modules-path>" "$<$<COMPILE_LANGUAGE:Fortran>:${FLANG_RT_OUTPUT_RESOURCE_MOD_DIR}>")
341
344
@@ -346,13 +349,19 @@ if (NOT WIN32)
346
349
get_target_property (default_target flang_rt.runtime.default ALIASED_TARGET )
347
350
add_library (flang_rt.runtime.unittest ALIAS "${default_target} " )
348
351
349
- add_dependencies (flang-rt-mod flang_rt.intrinsics flang_rt.runtime )
352
+ # Delect the target that compiles the sources
353
+ get_target_property (compile_target flang_rt.runtime.compile ALIASED_TARGET )
354
+ flang_module_target (${compile_target} )
355
+ add_dependencies (flang-rt-mod flang_rt.intrinsics ${compile_target} )
356
+
357
+
358
+
350
359
else ()
351
360
# Target for building all versions of the runtime
352
361
add_custom_target (flang_rt.runtime )
353
362
set_target_properties (flang_rt.runtime PROPERTIES FOLDER "Flang-RT/Meta" )
354
363
355
- function (add_win_flangrt_runtime libtype suffix msvc_lib )
364
+ function (add_win_flangrt_runtime libtype suffix msvc_lib )
356
365
set (name "flang_rt.runtime.${suffix} " )
357
366
358
367
add_flangrt_library (${name} .intrinsics OBJECT
@@ -380,9 +389,9 @@ else()
380
389
381
390
# "$<$<COMPILE_LANGUAGE:Fortran>:-Xflang>"
382
391
#TODO: Better as -fintrinsic-modules-path, need added option
383
- target_compile_options (${name} PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:SHELL: -fintrinsic-modules-path>" "$<$<COMPILE_LANGUAGE:Fortran>: ${CMAKE_CURRENT_BINARY_DIR} /module.${suffix} >" )
384
- target_compile_options (${name} .intrinsics PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:SHELL: -fintrinsic-modules-path>" "$<$<COMPILE_LANGUAGE:Fortran>: ${CMAKE_CURRENT_BINARY_DIR} /module.${suffix} >" )
385
- target_compile_options (${name} PRIVATE $< $< COMPILE_LANGUAGE:Fortran> :SHELL: -fintrinsic-modules-path> $< $< COMPILE_LANGUAGE:Fortran > : $ {RUNTIMES_OUTPUT_RESOURCE_MOD_DIR}> )
392
+ target_compile_options (${name} PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:-fintrinsic-modules-path= ${CMAKE_CURRENT_BINARY_DIR} /module.${suffix} >" )
393
+ target_compile_options (${name} .intrinsics PRIVATE "$<$<COMPILE_LANGUAGE:Fortran>:-fintrinsic-modules-path= ${CMAKE_CURRENT_BINARY_DIR} /module.${suffix} >" )
394
+ target_compile_options (${name} PRIVATE " $<$<COMPILE_LANGUAGE:Fortran>:-fintrinsic-modules-path= $ {RUNTIMES_OUTPUT_RESOURCE_MOD_DIR} >" )
386
395
387
396
if (msvc_lib )
388
397
set_target_properties (${name}
@@ -394,12 +403,19 @@ else()
394
403
# Setting an unique Fortran_MODULE_DIRECTORY is required for each variant to
395
404
# write a different .mod file.
396
405
# Except for one selected one (the first)
397
- if (_has_main_intrinsics )
398
- set_property (TARGET ${name} ${name} .intrinsics
399
- PROPERTY Fortran_MODULE_DIRECTORY "module.${suffix} "
400
- )
406
+ if (NOT _has_main_intrinsics )
407
+ flang_module_target (${name} .intrinsics )
408
+
409
+ get_target_property (compile_target ${name} .compile ALIASED_TARGET )
410
+ flang_module_target (${compile_target} )
411
+ add_dependencies (flang-rt-mod ${name} .intrinsics ${compile_target} )
412
+
413
+ #set_property(TARGET ${name} ${name}.intrinsics
414
+ # PROPERTY Fortran_MODULE_DIRECTORY "module.${suffix}"
415
+ #)
416
+ set (_has_main_intrinsics "YES" PARENT_SCOPE )
401
417
else ()
402
- set (_has_main_intrinsics "YES" PARENT_SCOPE )
418
+ # set(_has_main_intrinsics "YES" PARENT_SCOPE)
403
419
endif ()
404
420
405
421
0 commit comments