summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/DependencyGraph/OptimizeFortranCommon.cmake
blob: 354d3fc53c39e34c7ae1d333b2745b29dd5b2eda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
enable_language(C)
enable_language(Fortran)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY out)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY out)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY out)

add_library(FortranTop STATIC mylib.f90)
add_library(CMiddle STATIC mylib.c)
add_library(FortranBottom STATIC mylib.f90)

target_link_libraries(FortranTop PRIVATE CMiddle)
target_link_libraries(CMiddle PRIVATE FortranBottom)

if(OPTIMIZE_TOP)
  set_target_properties(FortranTop PROPERTIES
    OPTIMIZE_DEPENDENCIES TRUE)
endif()
if(OPTIMIZE_MIDDLE)
  set_target_properties(CMiddle PROPERTIES
    OPTIMIZE_DEPENDENCIES TRUE)
endif()

include(WriteTargets.cmake)
write_targets()