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 the external/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:
Ensuring that changes did not affect the build process of PCMSolver on its own (and ensuring that the tests still pass)
Including the PCMSolver build through FetchContent in a dummy CMake build. This was tested with the standard build, SHARED_LIBRARY_ONLY=ON, and STATIC_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:
cmake_minimum_required(VERSION 3.14)
project(Testing LANGUAGES C CXX Fortran)
include(FetchContent)
FetchContent_Declare(pcmsolver
GIT_REPOSITORY https://github.com/awild82/pcmsolver.git
GIT_TAG c0fe869a6245f28186af0329f6308f47e8ca75ea
)
FetchContent_MakeAvailable(pcmsolver)
add_executable(test_fetchcontent test.cxx)
target_link_libraries(test_fetchcontent PCMSolver)
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:
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