Goddard-Fortran-Ecosystem / pFUnit

Parallel Fortran Unit Testing Framework
Other
172 stars 45 forks source link

pFUnit installation not relocatable #371

Closed mennodeij closed 2 years ago

mennodeij commented 2 years ago

I notice that when I build pFUnit and install it at some location, then relocate the installation to another location, the CMake pFUnitConfig*.cmake files still contain the old location and using relocated pFUnit in the target application fails with:

PFUNIT could not be found because dependency GFTL could not be found.

or when GFTL is found

CMake Error in Code/tests/CMakeLists.txt:
  Imported target "PFUNIT::pfunit" includes non-existent path

    "<old-location>/include"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

It would be nice if this just worked. CMake is set up to support relocating installations with package config files.

mennodeij commented 2 years ago

I have traced this down to the fact that we bundle MPI with the installation, and find_package(MPI) will add include paths that are in the old location. For now SKIP_MPI=YES solves the problem.

tclune commented 2 years ago

OK - glad you found a solution. Improving "relocatability" is a gathering storm on several of my projects, and frankly I do not understand sufficient aspects as much as I would like. I'm closing the ticket, but will happily reopen if you can see a way to improve things.

mennodeij commented 2 years ago

The way I understand it is to use shared libraries and RPATH, but the details can still be finicky.