-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
Integrating `singularity-eos` into a CMake project | ||
================================================== | ||
|
||
Installing singularity-eos into a prefix, either manually or via Spack gives | ||
you an installation that can be used in other projects via CMake. Assuming | ||
your installation is visible to CMake, either by installing in a known prefix | ||
or setting ``CMAKE_PREFIX_PATH`` manually, a CMake project can integrate | ||
Singularity-EOS via ``find_package(singularity-eos)`` and using the provided | ||
targets to link to it. | ||
|
||
.. code:: cmake | ||
find_package(singularity-eos) | ||
... | ||
target_link_libraries(yourTarget PRIVATE singularity-eos::singularity-eos) | ||
The ``singularity-eos`` config module provides the following targets: | ||
|
||
``singularity-eos::singularity-eos_Interface``: | ||
The C++ header-only library, adding the necessary include directories and | ||
other dependencies such as mpark-variant and ports-of-call. | ||
|
||
``singularity-eos::singularity-eos_Library``: | ||
The static or shared library installed when building with | ||
``SINGULARITY_BUILD_CLOSURE=on``. If ``SINGULARITY_USE_FORTRAN=on``, this also includes the | ||
Fortran bindings and adds include path for its Fortran module. | ||
|
||
``singularity-eos::singularity-eos`` | ||
Convenience target that contains either | ||
``singularity-eos::singularity-eos_Interface``, | ||
``singularity-eos::singularity-eos_Library``, or both, depending on the | ||
COMPONENTS selection during ``find_package``. By default, if no COMPONENTS | ||
are specified both are included. | ||
|
||
Example: Integrating singularity-eos into a Fortran code | ||
-------------------------------------------------------- | ||
|
||
Fortran projects do not require the C++ header-only library and its | ||
dependencies, but only the compiled Fortran bindings provided by | ||
Singularity-EOS. To avoid unnecessary dependency checks by CMake, a Fortran | ||
project would integrate Singularity-EOS as follows: | ||
|
||
.. code:: cmake | ||
find_package(singularity-eos COMPONENTS Library) | ||
... | ||
target_link_libraries(yourTarget PRIVATE singularity-eos::singularity-eos) |