Hi All,
We’re currently converting a series of our in-house Fortran libraries to build with Spack, via CMake, and I’m having some issues with finding include directories from dependencies. So I have a few questions for you –
1) When I create a CMakeLists.txt file (for Library A), assuming that I install the *.mod files to a $<prefix>/include directory, do I need to export this include directory in some way so that Spack can ‘see’ it?
2) Library B then requires access to the *.mod files created in Library A to be able to compile. In the package.py file, I’ve currently got a depends_on(‘libA’). Do I need to do something else like create a cmake module so that one can use the find_package command in cmake. Or does Spack need something else?
Thanks,
Chris.
The information in this email and in any attachment(s) is commercial in confidence. If you are not the named addressee(s) or if you receive this email in error then any distribution, copying or use of this communication or the information in it is strictly prohibited. Please notify us immediately by email at admin.internet(at)awe.co.uk, and then delete this message from your computer. While attachments are virus checked, AWE plc does not accept any liability in respect of any virus which is not detected. AWE Plc Registered in England and Wales Registration No 02763902 AWE, Aldermaston, Reading, RG7 4PR
Hi All,
We’re currently converting a series of our in-house Fortran libraries to build with Spack, via CMake, and I’m having some issues with finding include directories from dependencies.
1) When I create a CMakeLists.txt file (for Library A), assuming that I install the *.mod files to a $<prefix>/include directory, do I need to export this include directory in some way so that Spack can ‘see’ it?
```# include containersinclude_directories(${PROJECT_SOURCE_DIR}/model/shared)# include generated rundeck_opts#include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)include(${CMAKE_CURRENT_BINARY_DIR}/modele_SOURCES.cmake)# Specify TARGETS.add_library(modele SHARED ${modele_SOURCES} ${EVERYTRACE_cf_mpi_REFADDR})target_link_libraries(modele ${EXTERNAL_LIBS} )# Set RPATH in the installed library# (although we are unlikely to ever install here)set_target_properties(modele PROPERTIES INSTALL_RPATH_USE_LINK_PATH TRUE)install(TARGETS modele DESTINATION lib)# modelE executableadd_executable(modelexe main.F90)# Set additional link library dependenciestarget_link_libraries(modelexe modele ${EXTERNAL_LIBS})install(TARGETS modelexe DESTINATION bin)if (INSTALL_MODS)install(DIRECTORY ${PROJECT_BINARY_DIR}/model/ DESTINATION includeFILES_MATCHING PATTERN "*.mod")endif()```
2) Library B then requires access to the *.mod files created in Library A to be able to compile. In the package.py file, I’ve currently got a depends_on(‘libA’). Do I need to do something else?
Do I need something else... like create a cmake module so that one can use the find_package command in cmake.
# Input Variables# MODELE_ROOT# Produces:# MODELE_LIBRARY# MODELE_INCLUDE_DIRFIND_PATH(MODELE_INCLUDE_DIR diag_zonal.modHINTS ${MODELE_ROOT}/include)FIND_LIBRARY(MODELE_LIBRARY NAMES modeleHINTS ${MODELE_ROOT}/lib)IF (MODELE_INCLUDE_DIR AND MODELE_LIBRARY)SET(MODELE_FOUND TRUE)ENDIF (MODELE_INCLUDE_DIR AND MODELE_LIBRARY)IF (MODELE_FOUND)IF (NOT MODELE_FIND_QUIETLY)MESSAGE(STATUS "Found xxx MODELE_LIBRARY: ${MODELE_LIBRARY}")MESSAGE(STATUS "Found xxx MODELE_INCLUDE_DIR: ${MODELE_INCLUDE_DIR}")ENDIF (NOT MODELE_FIND_QUIETLY)ELSE (MODELE_FOUND)IF (MODELE_FIND_REQUIRED)MESSAGE(FATAL_ERROR "Could not find MODELE")ENDIF (MODELE_FIND_REQUIRED)ENDIF (MODELE_FOUND)
Or does Spack need something else?
Thanks for all of that Elizabeth,
I’m now currently in the process of creating some FindLibrary files as recommended – I’m still bit of a newbie to both CMake and Spack.
Thanks again,
Regards,
Chris.
--
You received this message because you are subscribed to the Google Groups "Spack" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
spack+un...@googlegroups.com.
To post to this group, send email to sp...@googlegroups.com.
Visit this group at https://groups.google.com/group/spack.
For more options, visit https://groups.google.com/d/optout.