stan-dev / stan-dev/math

Allow cmake users to use FetchContent_Declare

Open
#2,967 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
839
Forks
220
Avg merge
2d 4h
Merged PRs (30d)
14

Description

Description

It would be nice for cmake users to be able to use something like the following to include Stan math in their projects

include(FetchContent)

FetchContent_Declare(
  stanmath
  GIT_REPOSITORY https://github.com/stan-dev/math
  GIT_TAG        v4.7.0
)

FetchContent_MakeAvailable(stanmath)

I have part of this written here where I have stan math compiling with cmake. I'd be happy to expand this into a CMakeLists.txt file in the stan math repo, which would then allow cmake users to do something like the above to include stan math in their projects.

Do any folks have objections to this? I'd say the cmake file I have there is like 60% complete. It does all the correct includes, but does not handle some of the specific flags we use. It also does not support MPI, but that should be easy to setup.

If I set this up we could also setup our test suite to integrate with ctest

Expected Output

Please provide the expected output.

If this is a bug report, show what you expected to happen. Please also show what currently happens.

If this is a feature request, show what you expect to happen if the feature exists.

Current Version:

v4.7.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the referenced stan-perf CMakeLists.txt and compare its include setup with Stan Math's current build requirements, including the project-specific flags and MPI support. Done when FetchContent_MakeAvailable(stanmath) works for v4.7.0 and the test suite can be integrated with ctest.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.