Skip to content

Instantly share code, notes, and snippets.

@mfdeveloper
Created May 7, 2020 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mfdeveloper/f822aea8495884bd1c019a3072f3690c to your computer and use it in GitHub Desktop.
Save mfdeveloper/f822aea8495884bd1c019a3072f3690c to your computer and use it in GitHub Desktop.
Add support to GoogleTest library for unit tests on C++ Cmake projects
# This commands/functions bellow is to allow Cmake C++ projects to use GoogleTest library to TDD (unit tests)
# The package gtest is compatible with built-in CMake targets:
enable_testing()
find_package(GTest CONFIG REQUIRED)
target_link_libraries(main PRIVATE GTest::gtest GTest::gtest_main GTest::gmock GTest::gmock_main)
add_test(AllTestsInMain main)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment