-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Use Fetchcontent instead of ExternalProject #3314
Conversation
Hi, instead of ExternalProject and a new file that is spawned in a new process, it's easier to just use FetchContent. cmake 3.14 should be old enough to be spread.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for this pull request! This update goes well with our new CMake Quickstart.
googletest/README.md
Outdated
then invoked as a sub-build _during the CMake stage_. That directory is then | ||
pulled into the main build with `add_subdirectory()`. For example: | ||
The last of the above methods is implemented with a small piece of CMake code so | ||
the code is pulled into the main build. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might disambiguate the second use of "code" here:
"The last of the above methods is implemented with a small piece of CMake code that downloads and pulls the GoogleTest code into the main build."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"small piece of CMake" would be sufficient, I think. Or CMake script.
As the requested changes tab only listed the part with the 2 code, I changed only that one for now. I thought shortly about adding the GIT_TAG, but in the old example there was GIT_TAG master, which basically is the default, but also is the opposite of advising to stick to a version. For adding the shared_crt, I'm unsure where, as the chapter where it was at the end of isn't there anymore. If you have any idea on that, just let me know, I hadn't any trouble with this atm on Win, Linux and Mac, but I usually use CmDaB for this task with is (not very well atm) documented here, but I don't think your docs are the right place to promote that. |
|
googletest/README.md
Outdated
include (FetchContent) | ||
FetchContent_Declare( | ||
googletest | ||
GIT_REPOSITORY https://github.com/google/googletest.git |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In our CMake Quickstart we use URL
instead of GIT_REPOSITORY
and GIT_TAG
to avoid downloading the full Git history and instead download the code at a specific release. Could we use that approach here too?
GIT_REPOSITORY https://github.com/google/googletest.git | |
# Specify the commit you depend on and update it regularly. | |
URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, make sense if users should stick with a specific version. For myself, I prefer the git, diskspace isn't that big problems nowadays and I like to see if something breaks as early as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks good to me! We've pulled this in for internal review. Please don't push any more changes to this PR as they might be overwritten.
(369506093)
Hi,
instead of ExternalProject and a new file that is spawned in a new process, it's easier to just use FetchContent. cmake 3.14 should be old enough to be spread.