Do transitive interace includes propagate to compilation of Fortran sources?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Do transitive interace includes propagate to compilation of Fortran sources?

Zaak Beekman
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.
1509 16th St, NW
Washington, DC 20036
mobile: <a href="tel:(917)%20797-3239" value="+19177973239" target="_blank">(917) 797-3239
-------------------------------------------------------------------------------

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: Do transitive interace includes propagate to compilation of Fortran sources?

Zaak Beekman
Hi,

OK, unless the answer to the question in the subject line should be "NO", then please disregard this email. I think I was having a caching issue with my super build setup. I'm pretty sure that transitive includes are being correctly propagated now.

Sorry for the noise,
Zaak

On Fri, Jul 27, 2018 at 4:47 PM Zaak Beekman <[hidden email]> wrote:
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.
1509 16th St, NW
Washington, DC 20036
mobile: <a href="tel:(917)%20797-3239" value="+19177973239" target="_blank">(917) 797-3239
-------------------------------------------------------------------------------

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake