Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add to readme cmake FetchContent section #293

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,8 @@ PROJECT(myproject)

# fetch latest argparse
include(FetchContent)
set(ARGPARSE_BUILD_TESTS OFF CACHE INTERNAL "Turn off building argparse tests")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These options should be OFF by default for subprojects (i.e. NOT PROJECT_IS_TOP_LEVEL)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly agree with you. The only thing is that PROJECT_IS_TOP_LEVEL is available in CMake versions 3.21+ and argparse uses CMake minimum version 3.12.4 as of now. There are ways around this of course like checking if PROJECT_NAME is defined (Catch2 uses this tactic) which I plan to use. The PR should be up in around the next hour if everything works out. Also, the install targets shouldn't be set when using as a subproject too, and as of now ARGPARSE_INSTALL defaults to ON.

set(ARGPARSE_BUILD_SAMPLES OFF CACHE INTERNAL "Turn off building argparse samples")
FetchContent_Declare(
argparse
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
Expand Down
Loading