Skip to content

Commit

Permalink
CMake: fix race conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
xoviat committed Jan 1, 2018
1 parent e315207 commit c376c71
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions runtime/flang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -475,23 +475,15 @@ SET(FTN_SUPPORT
xfer.c
init.c
xfer_rpm1.c
)

add_library(iso_c_bind OBJECT
iso_c_bind.F95
)

add_library(ieee_arithmetic OBJECT
ieee_arithmetic.F95
ieee_exceptions.F95
)
)

add_flang_library(flang_static
${FTN_INTRINSICS}
${FTN_SUPPORT}
${SHARED_SOURCES}
$<TARGET_OBJECTS:iso_c_bind>
$<TARGET_OBJECTS:ieee_arithmetic>
)

set_target_properties(flang_static
Expand All @@ -511,8 +503,6 @@ add_flang_library(flang_shared
${FTN_INTRINSICS}
${FTN_SUPPORT}
${SHARED_SOURCES}
$<TARGET_OBJECTS:iso_c_bind>
$<TARGET_OBJECTS:ieee_arithmetic>
)

set_property(TARGET flang_shared PROPERTY OUTPUT_NAME flang)
Expand Down Expand Up @@ -566,6 +556,22 @@ set_property(
## CMake does not handle module dependencies between Fortran files,
## we need to help it

if( NOT ${CMAKE_GENERATOR} STREQUAL "Ninja")
# State the module that the source is producing
set_source_files_properties(
iso_c_bind.F95
PROPERTIES
OBJECT_OUTPUTS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
)

# State a dependency on the module
set_source_files_properties(
ieee_arithmetic.F95
ieee_exceptions.F95
PROPERTIES
OBJECT_DEPENDS ${CMAKE_Fortran_MODULE_DIRECTORY}/iso_c_binding.mod
)
endif()

set_target_properties(flang_static flang_shared
PROPERTIES
Expand Down Expand Up @@ -596,15 +602,6 @@ add_dependencies(flang_shared
flang2
)

add_dependencies(iso_c_bind
flang1
flang2
)

add_dependencies(ieee_arithmetic
iso_c_bind
)

if (NOT MSVC)
target_compile_options(flang_static PRIVATE -fPIC)
target_compile_options(flang_shared PRIVATE -fPIC)
Expand Down

0 comments on commit c376c71

Please sign in to comment.