insightjilo.blogg.se

Force cmake variables externally
Force cmake variables externally







force cmake variables externally

force cmake variables externally

it is provided by the system or you are happy to manually build it outside of your project), then CMake makes it trivial to bring gtest into your project with the find_package() command. The approach is general enough to be applied to any CMake-based external project, not just gtest/gmock.īefore proceeding, I should highlight that if you are only interested in gtest and you do have a pre-built gtest available (e.g.

Force cmake variables externally manual#

Unlike other common approaches, no manual information has to be provided other than the package to download. This article demonstrates a convenient way to add them with automated source download and have them build directly as part of your project using add_subdirectory(). Not so awesome is when you don’t have a pre-built gtest/gmock available to use. The module documentation uses GoogleTest in some of its examples. The generalised implementation was extended further and became the FetchContent module, which was added to CMake in 3.11. I’ve also revised the general purpose implementation to make it more flexible, expanded its documentation and made it available on Github under a MIT license. I’ve updated the content here to reflect the changes and the article now also covers both gtest and gmock. Since the original article was written, gtest and gmock have been merged and moved into a single repository on Github under the name GoogleTest.









Force cmake variables externally