jacobwilliams / json-fortran

A Modern Fortran JSON API
https://jacobwilliams.github.io/json-fortran/
Other
338 stars 86 forks source link

Only install module files, not config dir with IDE #396

Closed zbeekman closed 5 years ago

zbeekman commented 5 years ago
zbeekman commented 5 years ago

This will prevent mod files from getting installed into the include directory/mod install destination under and additional subdirectory (e.g., include/Debug/... or include/Release/...) which causes issues when consuming the project if built with an IDE (and also if consuming from another project being built with an IDE, but a different build config).

codecov-io commented 5 years ago

Codecov Report

Merging #396 into master will not change coverage. The diff coverage is n/a.

@@          Coverage Diff           @@
##           master    #396   +/-   ##
======================================
  Coverage    88.4%   88.4%           
======================================
  Files           3       3           
  Lines        4778    4778           
======================================
  Hits         4224    4224           
  Misses        554     554
zbeekman commented 5 years ago

First try wasn't quite right, so I force pushed an amended commit to resolve the problem.

Basically, the CMake config file says to look in, e.g., $<prefix>/include but when built and installed with CMake generated MSVS solution files, then the mod files get installed into $<prefix>/include/$<CONFIG>... Always a joy working with MS stuff.

zbeekman commented 5 years ago

OK, it seems that this still isn't working quite as I had hoped. I'll have to investigate further.

zbeekman commented 5 years ago

@jacobwilliams This is ready to go now. The installation logic ensures that additional directory structure (e.g., ${CMAKE_INSTALL_PREFIX}/include/debug -> ${CMAKE_INSTALL_PREFIX}/include) gets stripped out during installation.

The motivation for this is that projects that want/need to build everything with an IDE like MSVS will fail to find module files of dependencies like JSON-Fortran, if there is a different subdirectory for includes etc. because the main project is being built as, e.g., a Release build, but the dependencies were built as a Debug build.

(For production releases you want everything built as a release build, but for debugging your project it is useful to be able to build against targets that had a different build configuration)