-
Notifications
You must be signed in to change notification settings - Fork 43
Fix cmake for installation to a location #233
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
base: master
Are you sure you want to change the base?
Changes from 1 commit
d31ab33
583a2ce
e09d264
0cd3331
0d73dc6
7eb30d2
311cd88
008ff13
816fcee
6266504
71df74c
e67d36a
3b88a78
1180287
6db4f60
35be353
3c5840d
fb9bddd
f9167d4
09cc80a
8701ef2
1d87f21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -29,11 +29,14 @@ project(libROM | |
| HOMEPAGE_URL "https://github.com/LLNL/libROM" | ||
| LANGUAGES C CXX Fortran) | ||
|
|
||
| include(GNUInstallDirs) | ||
|
|
||
| set(libROM_CMAKE_PATH ${CMAKE_SOURCE_DIR}/cmake) | ||
| set(libROM_CMAKE_MODULE_PATH ${libROM_CMAKE_PATH}/modules) | ||
| list(APPEND CMAKE_MODULE_PATH ${libROM_CMAKE_MODULE_PATH}) | ||
|
|
||
| option(USE_MFEM "Build libROM with MFEM" OFF) | ||
| option(USE_EXTERNAL_MFEM "Build libROM with external MFEM specified in -DMFEM_DIR" OFF) | ||
| option(MFEM_USE_GSLIB "Build libROM with MFEM using GSLIB" OFF) | ||
| option(BUILD_STATIC "Build libROM as a static library" OFF) | ||
| option(ENABLE_EXAMPLES "Build examples and regression tests" ON) | ||
|
|
@@ -111,6 +114,11 @@ find_package(Doxygen 1.8.5) | |
|
|
||
| find_package(GTest 1.6.0) | ||
|
|
||
| if (USE_EXTERNAL_MFEM) | ||
| find_library(MFEM mfem "${MFEM_DIR}/lib") | ||
| find_path(MFEM_INCLUDES mfem.hpp "${MFEM_DIR}/include") | ||
| endif() | ||
|
|
||
| if (USE_MFEM) | ||
| find_library(MFEM mfem "${CMAKE_SOURCE_DIR}/dependencies/mfem" "${MFEM_DIR}/lib") | ||
|
||
| find_library(HYPRE HYPRE "${CMAKE_SOURCE_DIR}/dependencies/hypre/src/hypre/lib" "${HYPRE_DIR}/lib") | ||
|
|
@@ -301,3 +309,41 @@ if(DOXYGEN_FOUND) | |
| add_dependencies(doxygen_tagfile documentation) | ||
|
|
||
| endif(DOXYGEN_FOUND) | ||
|
|
||
| #------------------------------------------------------------------------------- | ||
| # Installation | ||
| # Configure CMake find_package() config files | ||
| #------------------------------------------------------------------------------- | ||
|
|
||
| # Default option | ||
| if (NOT CMAKE_BUILD_TYPE) | ||
| set(CMAKE_BUILD_TYPE "Release") | ||
| endif() | ||
|
|
||
| include(CMakePackageConfigHelpers) | ||
|
|
||
| # Extract the enabled languages required to use ROM | ||
| get_property(ROM_ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) | ||
|
|
||
| configure_package_config_file( | ||
| "${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in" | ||
| "${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake" | ||
| INSTALL_DESTINATION | ||
| ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
| PATH_VARS | ||
| ROM_ENABLED_LANGUAGES | ||
| ) | ||
|
|
||
| write_basic_package_version_file( | ||
| "${PROJECT_NAME}ConfigVersion.cmake" | ||
| VERSION ${PROJECT_VERSION} | ||
| COMPATIBILITY SameMajorVersion | ||
| ) | ||
|
|
||
| install(FILES | ||
| ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake | ||
| ${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake | ||
| DESTINATION | ||
| ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} | ||
| ) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| ## Some copyright problably goes here | ||
|
||
| ## Some licence should problably go here | ||
|
|
||
| @PACKAGE_INIT@ | ||
|
|
||
| include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@_Targets.cmake") | ||
|
|
||
| check_required_components("@PROJECT_NAME@") | ||
| check_required_components("ROM") | ||
|
|
||
| # Variables required for linking etc. | ||
| set(libROM_LIBRARIES ROM) | ||
| set(libROM_ENABLED_LANGUAGES "@ROM_ENABLED_LANGUAGES@") | ||
|
|
||
| check_required_components("@PROJECT_NAME@") | ||
| check_required_components("ROM") | ||
|
|
||
|
|
||
| # Somehow the dependencies should go here -> Did not yet get this working | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not exactly sure we need this part, or even
USE_EXTERNAL_MFEM.If we want to use external mfem directory, we can specify with the cmake flag
-DMFEM_DIR=/path/to/mfem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I only understand this partly. Do you mean that we can streamline the input
-DMFEM_DIRand-DUSE_EXTERNAL_MFEM? This is what I have streamlined in a new commit. If-DMFEM_DIRis not empty it will set the booleanUSE_EXTERNAL_MFEMtotrue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is removed.