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

Use Fetchcontent instead of ExternalProject #3314

Merged
merged 4 commits into from
Apr 21, 2021
Merged

Use Fetchcontent instead of ExternalProject #3314

merged 4 commits into from
Apr 21, 2021

Conversation

Vollstrecker
Copy link
Contributor

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.

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.
@google-cla google-cla bot added the cla: yes label Mar 13, 2021
@derekmauro derekmauro assigned ghost Mar 15, 2021
Copy link

@ghost ghost left a 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.

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.
Copy link

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."

Copy link
Contributor Author

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.

@Vollstrecker
Copy link
Contributor Author

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.

@dotam99
Copy link

dotam99 commented Apr 14, 2021

  • [ ]

@Vollstrecker Vollstrecker requested a review from a user April 14, 2021 21:13
include (FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
Copy link

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?

Suggested change
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

Copy link
Contributor Author

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.

Copy link

@ghost ghost left a 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)

@ghost ghost added the imported-into-CL label Apr 21, 2021
@asoffer asoffer merged commit 23ef295 into google:master Apr 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants