Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STIR CMake cache does not store dependancy paths #1516

Open
robbietuk opened this issue Sep 22, 2024 · 1 comment
Open

STIR CMake cache does not store dependancy paths #1516

robbietuk opened this issue Sep 22, 2024 · 1 comment

Comments

@robbietuk
Copy link
Collaborator

STIR's dependency paths need defining in CMake projects using STIR. Trying to use https:/UCL/STIR/blob/master/examples/C%2B%2B/using_installed_STIR/CMakeLists.txt as my guide.

The examples below shows the common steps I have to go through to provide the ROOT_DIR and parallelproj_DIR paths to my project. Could it be made such that the STIR CMake build/install stores these dependency paths for use by child projects? There are probably other dependencies that could also be referenced in this way. Surely, these paths need to match those used in the STIR install anyway...

STIR_DIR

Running

cmake . -DSTIR_DIR=${STIR_install_path}/lib/cmake/STIR-6.0

results in (some path obfuscation)

CMake Error at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  CERN ROOT not found.  If you do have it, set ROOT_DIR (preferred), ROOTSYS
  or add root-config to your path (missing: CERN_ROOT_VERSION
  CERN_ROOT_LIBRARIES CERN_ROOT_INCLUDE_DIRS) (Required is at least version
  "6.29.01")
Call Stack (most recent call first):
  /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  ${STIR_install_path}/lib/cmake/STIR-6.0/FindCERN_ROOT.cmake:171 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  ${STIR_install_path}/lib/cmake/STIR-6.0/STIRConfig.cmake:137 (find_package)
  CMakeLists.txt:6 (find_package)

ROOT_DIR

Adding the ROOT_DIR

cmake . -DSTIR_DIR=${STIR_install_path}/lib/cmake/STIR-6.0 -DROOT_DIR=${ROOT_INSTALL_PATH}/cmake

which results in

CMake Error at ${STIR_install_path}/lib/cmake/STIR-6.0/STIRConfig.cmake:171 (find_package):
  Could not find a package configuration file provided by "parallelproj" with
  any of the following names:

    parallelprojConfig.cmake
    parallelproj-config.cmake

  Add the installation prefix of "parallelproj" to CMAKE_PREFIX_PATH or set
  "parallelproj_DIR" to a directory containing one of the above files.  If
  "parallelproj" provides a separate development package or SDK, be sure it
  has been installed.
Call Stack (most recent call first):
  CMakeLists.txt:6 (find_package)

parallelproj_DIR

Finally adding the parallelproj_DIR

cmake . -DSTIR_DIR=${STIR_install_path}/lib/cmake/STIR-6.0 -DROOT_DIR=${ROOT_INSTALL_PATH}/cmake -Dparallelproj_DIR=${PARALLELPROJ_INSTALL_PATH}/lib/cmake/parallelproj

and cmake configures and generates and the

@robbietuk
Copy link
Collaborator Author

A brief bit of reading seems to suggest these paths are stored in the STIRTargets.cmake file in the STIR install.

Interestingly, STIR seems to be doing this kind of thing already with HDF5 as this line exists in my STIRTargets.cmake

INTERFACE_LINK_LIBRARIES "ROOT::Tree;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5_cpp.so;/usr/lib/x86_64-linux-gnu/hdf5/serial/libhdf5.so;/usr/lib/x86_64-linux-gnu/libcrypto.so;/usr/lib/x86_64-linux-gnu/libcurl.so;/usr/lib/x86_64-linux-gnu/libpthread.a;/usr/lib/x86_64-linux-gnu/libsz.so;/usr/lib/x86_64-linux-gnu/libz.so;/usr/lib/x86_64-linux-gnu/libdl.a;/usr/lib/x86_64-linux-gnu/libm.so;modelling_buildblock;listmode_buildblock"

@robbietuk robbietuk changed the title using_installed_STIR does not store dependancy paths STIR CMake cache does not store dependancy paths Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant