[CMake] Do transitive interace includes propagate to compilation of Fortran sources?

Zaak Beekman zbeekman at gmail.com
Fri Jul 27 16:47:53 EDT 2018


I'm trying to use a superbuild to tightly control third party libraries for
an application. They will all be statically linked in the end (besides deps
like MPI that are effective system libraries). I have the following code in
the TPL's CMakeLists.txt that I am trying to link into the main application:

```cmake
# Make VTKmofo static library
add_library(vtkmofo STATIC ${VTKmofo_sources})

# Tell CMake where to put vtkmofo .mod files generated with libvtkmofo
set_property(TARGET vtkmofo
  PROPERTY
  Fortran_MODULE_DIRECTORY ${VTKmofo_mod_dir})

# Tell consumers where to find .mod files
target_include_directories(vtkmofo PUBLIC
  $<BUILD_INTERFACE:${VTKmofo_mod_dir}>
  $<INSTALL_INTERFACE:include/vtkmofo/mod>
  )

install(TARGETS vtkmofo DESTINATION lib EXPORT vtkmofo-targets)
install(EXPORT vtkmofo-targets DESTINATION lib/vtkmofo)
install(DIRECTORY "${VTKmofo_mod_dir}" DESTINATION include/vtkmofo) # i.e.,
include/vtkmofo/mod/*.mod
```

In the other main project I have:

```cmake
include("${VTKmofo_ROOT}/lib/vtkmofo/vtkmofo-targets.cmake")
...
target_link_libraries(FrapUtility PUBLIC Math MatLib vars ECI Coolant
vtkmofo)
```

Through transitive properties I would expect that the sources for
FrapUtility (all modern Fortran sources) would get the
`-I.../include/vtkmofo/mod` flag passed during compilation. Am I missing
something?


Thanks,
Zaak

Izaak "Zaak" Beekman

-------------------------------------------------------------------------------

HPC Scientist
ParaTools Inc. <http://www.paratools.com/>
1509 16th St, NW
Washington, DC 20036
mobile: (917) 797-3239
-------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180727/293dbbd9/attachment.html>


More information about the CMake mailing list