Fix CMake to work with FetchContent #196
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request makes some trivial changes to the CMake structure in order to enable inclusion of PCMSolver in other projects via FetchContent. In particular, it adds the
api
directory as an interface include directory on both the shared and static targets, and it makes theexternal/Catch
directory relative to the PCMSolver root, not the total build root.Motivation and Context
This PR enables inclusion of PCMSolver through FetchContent.
How Has This Been Tested?
This PR was primarily tested through:
SHARED_LIBRARY_ONLY=ON
, andSTATIC_LIBRARY_ONLY=ON
. I only tested this on a CentOS 7 server, but none of the code I changed should affect builds on Windows or Mac, so I don't expect issues from those installations either.FetchContent CMake build details
The structure of the dummy CMake project is a single
CMakeLists.txt
and a single source file,test.cxx
.The
CMakeLists.txt
file had the following content:The only non-standard thing here is that this project must be declared having a Fortran language dependency when linking against the PCMSolver static library in order for the Fortran symbols from
pedra
to be resolved.The
test.cxx
file can be pretty much whatever you like to test inclusion and linking. I used some code from the C host example:The final executable was executed and gave the expected print to stdout.
Types of changes
Status