https://github.com/wavefunction91/cmake-modules
Collection of modern CMake modules that target HPC software
https://github.com/wavefunction91/cmake-modules
Last synced: 5 months ago
JSON representation
Collection of modern CMake modules that target HPC software
- Host: GitHub
- URL: https://github.com/wavefunction91/cmake-modules
- Owner: wavefunction91
- Created: 2018-09-21T17:03:03.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-11-05T19:50:47.000Z (over 6 years ago)
- Last Synced: 2025-04-10T09:07:42.498Z (about 1 year ago)
- Language: CMake
- Size: 49.8 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
A collection of CMake files for commonly used HPC libraries which export targets for simple
dependency tracking and linking.
For example, consider a software which has to link to ParMETIS. ParMETIS has a linkage
dependency on METIS, which must also be installed. The traditional manner of handling
this would be to find both packages and handle the linkage separately,
```cmake
find_package( METIS )
find_package( ParMETIS )
include_directories( ${METIS_INCLUDE_DIR} )
include_directories( ${PARMETIS_INCLUDE_DIR} )
add_executable( test test.cxx )
target_link_libraries( test ${PARMETIS_LIBRARIES} )
target_link_libraries( test ${METIS_LIBRARIES} )
```
Here the order matters if linking statically, METIS must be linked *after*
ParMETIS.
The included CMake files handle this is a more coherent manner through the use
of CMake targets. See [this article](https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/)
for more details.
```cmake
find_package( ParMETIS )
add_executable( test test.cxx )
target_link_libraries( test PatMETIS::parmetis )
```
This not only handles the dependency of ParMETIS on METIS, but also removes
the need to explicitly pass anything to `include_directories`.