KCL-BMEIS / niftyreg

This project contains command line tools to perform rigid, affine and non-linear registration of nifti or analyse images as well as utilities
BSD 3-Clause "New" or "Revised" License
141 stars 42 forks source link

exported CONFIG.cmake problems #106

Open KrisThielemans opened 11 months ago

KrisThielemans commented 11 months ago

Using NIFTYREG_LIBRARIES fails as these are just the names of the libraries, not absolute paths, and their dependencies are not exported. We currently work around this as in https://github.com/SyneRBI/SIRF/blob/master/src/CMakeLists.txt#L53-L71

I believe this needs

install(TARGETS somelib EXPORT NIFTYREGTargets 
   RUNTIME_DESTINATION ...)

for every library, and in cmake/CMakeLists.txt

install(EXPORT NIFTYREGTargets DESTINATION "${ConfigPackageLocation}")

Also, as opposed to doing https://github.com/KCL-BMEIS/niftyreg/blob/6db8b16c17884a9b8859c980c4f1c408f62bd9ca/CMakeLists.txt#L173-L174 It is now recommended to depend on OpenMP::OpenMP_C (or OpenMP::OpenMP_CXX). Linking and includes will then be automatically ok. Similar stuff for CUDA I guess.