@@ -335,12 +335,9 @@ SET(FTN_SUPPORT
335335 descIntrins.c
336336 descFioUtil.c
337337 descRW.c
338- ieee_arithmetic.F95
339- ieee_exceptions.F95
340338 ieee_features.F95
341339 initpar.c
342340 inquire.c
343- iso_c_bind.F95
344341 iso_fortran_env.f90
345342 ldread.c
346343 ldwrite.c
@@ -477,16 +474,25 @@ SET(FTN_SUPPORT
477474 xfer_rpm1.c
478475 )
479476
477+ add_library (iso_c_bind
478+ iso_c_bind.F95
479+ )
480+
481+ add_library (ieee_arithmetic
482+ ieee_arithmetic.F95
483+ ieee_exceptions.F95
484+ )
485+
480486add_flang_library(flang_static
481487 ${FTN_INTRINSICS}
482488 ${FTN_SUPPORT}
483489 ${SHARED_SOURCES}
484490 )
485491
486492if (MSVC )
487- set_property (TARGET flang_static PROPERTY OUTPUT_NAME libflang)
493+ set_property (TARGET flang_static PROPERTY OUTPUT_NAME libflang)
488494else ()
489- set_property (TARGET flang_static PROPERTY OUTPUT_NAME flang)
495+ set_property (TARGET flang_static PROPERTY OUTPUT_NAME flang)
490496endif ()
491497
492498set (SHARED_LIBRARY TRUE )
@@ -545,20 +551,6 @@ set_property(
545551## CMake does not handle module dependencies between Fortran files,
546552## we need to help it
547553
548- # State the module that the source is producing
549- set_source_files_properties (
550- iso_c_bind.F95
551- PROPERTIES
552- OBJECT_OUTPUTS ${CMAKE_Fortran_MODULE_DIRECTORY} /iso_c_binding.mod
553- )
554-
555- # State a dependency on the module
556- set_source_files_properties (
557- ieee_arithmetic.F95
558- ieee_exceptions.F95
559- PROPERTIES
560- OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY} /iso_c_binding.mod
561- )
562554
563555set_target_properties (flang_static flang_shared
564556 PROPERTIES
@@ -589,6 +581,18 @@ add_dependencies(flang_shared
589581 flang2
590582 )
591583
584+ add_dependencies (iso_c_bind
585+ flang1
586+ flang2
587+ )
588+
589+ add_dependencies (ieee_arithmetic
590+ iso_c_bind
591+ )
592+
593+ target_link_libraries (flang_static iso_c_bind ieee_arithmetic)
594+ target_link_libraries (flang_shared iso_c_bind ieee_arithmetic)
595+
592596if (NOT MSVC )
593597 target_compile_options (flang_static PRIVATE -fPIC)
594598 target_compile_options (flang_shared PRIVATE -fPIC)
0 commit comments