You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DGtal is not relocatable (the install tree cannot be moved to other computer) when compiled with these dependencies.
The installed DGtal target contains full paths to the Foo_INCLUDE_DIRECTORY and/or Foo_LIBRARIES, which makes it not relocatable.
This is not a problem if we know beforehand where these dependencies will be installed (homebrew, specific OS, etc.) but it is cumberstone to set it up for different platforms.
This is an extract of DGtalLibraryDepends.cmake (exported targets) of the install tree, showing full paths.
The imported targets with the signature Foo::Foo are the best solution (CMake docs), but there are packages that don't
provide a FooConfig.cmake with FooTargets.cmake. In this case, I think the best solution would be to
improve the FindFoo.cmake to create an imported target inside FindFoo.cmake. This approach is done by Kitware/CMake for ZLIB::ZLIB, another HPC user has done it for FFTW3.
The current FindGMP.cmake (Cairo, QGLViewer, Magick++), would need to be improved to generate imported target GMP::GMP instead of just GMP_INCLUDE_DIR and GMP_LIBRARIES.
Thanks @phcerdan for the link.. it looks like Pablo Arias "Don't do that" example looks pretty similar to the current DGtal setting ;)
Hehe a bit, at least now we don't modify CXX_FLAGS or use global include_directories, link_libraries!
The good thing is that the core DGtal (without those dependencies) is indeed relocatable, but some tweaking would be needed if we are interested in shipping DGtal with those extra deps.
phcerdan
changed the title
CMake: Create realocatable packages: improve Find[GMP, CAIRO, QGLViewer, Magick++ FFTW3].cmake to create imported targets.
CMake: Create relocatable packages: improve Find[GMP, CAIRO, QGLViewer, Magick++ FFTW3].cmake to create imported targets.
Jan 12, 2021
DGtal
is not relocatable (the install tree cannot be moved to other computer) when compiled with these dependencies.The installed DGtal target contains full paths to the
Foo_INCLUDE_DIRECTORY
and/orFoo_LIBRARIES
, which makes it not relocatable.This is not a problem if we know beforehand where these dependencies will be installed (homebrew, specific OS, etc.) but it is cumberstone to set it up for different platforms.
This is an extract of
DGtalLibraryDepends.cmake
(exported targets) of the install tree, showing full paths.The imported targets with the signature
Foo::Foo
are the best solution (CMake docs), but there are packages that don'tprovide a FooConfig.cmake with FooTargets.cmake. In this case, I think the best solution would be to
improve the FindFoo.cmake to create an imported target inside FindFoo.cmake. This approach is done by Kitware/CMake for
ZLIB::ZLIB, another HPC user has done it for FFTW3.
The current
FindGMP.cmake
(Cairo
,QGLViewer
,Magick++
), would need to be improved to generate imported target GMP::GMP instead of justGMP_INCLUDE_DIR
andGMP_LIBRARIES
.For a short tutorial about this topic and other modern CMake areas: It’s Time To Do CMake Right | Pablo Arias
The text was updated successfully, but these errors were encountered: