Our great sponsors
-
WorkOS
The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
if(EXISTS $ENV{HOME}/local/repo/googletest) set(repo_googletest "file://$ENV{HOME}/local/repo/googletest") else() set(repo_googletest "https://github.com/google/googletest.git") endif() include(FetchContent) set(BUILD_GMOCK TRUE CACHE BOOL "" FORCE) # do not repeat option, because of description FetchContent_Declare(googletest GIT_REPOSITORY ${repo_googletest} GIT_TAG release-1.11.0 ) FetchContent_MakeAvailable(googletest)
The whole thing can be wrapped in a function, of course. Example: https://gitlab.com/mariokonrad/timesheet/-/blob/master/cmake/UsePackage.cmake (sorry for the lack of documentation, at least there is a TODO ;-)