![]() REPEAT: Do NOT report bugs for outdated packages Tasklist. CMAKE_BUILD_TYPE not being used in CMakeLists. Use the flag out of date link on the package page, or the Mailing List.Target_link_libraries(tests soccl gtest gmock) Target_compile_features(soccl PUBLIC "cxx_std_14") Target_include_directories(soccl PUBLIC "include") Using FetchContent () to integrate gtest into project in cmake seems to be missing the relevant include path for gtest/gtest.h. Or you can disable warnings in the code itself. Thus configuring your project using CMake, it should be able to findpackage (GTest) using the usual search procedure. So now you can add this path to the CMAKEPREFIXPATH variable. ![]() Tags: c++cmakegoogle testgoogletestgtestlibgtest-devpthreadubuntuunit test. Then try to locate the GTestConfig.cmake file in the installation directory. Nice and simple // tests.cpp include whattotest.cpp include .If there is any practical option of fixing those warnings, it would be better in the long run. First you must build AND install Googletest using CMake build system. Specify the test or suite to be included in the configuration, or provide a pattern for filtering test names. To create a Google Test configuration, go to Run Edit Configurations, click and select Google Test from the list of templates. Set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) set (CMAKECFLAGS '-g -O0 -fprofile-arcs -ftest-coverage') Of course, compiler warnings are normally a good thing. CLion automatically creates a Google Test configuration for every CMake target linked with gtest or gmock. Then I tried to compile this sample file include 'gmock/gmock.h' in. I have successfully run sudo apt-get install google-mock. # Prevent overriding the parent project's compiler/linker Note: addgtest is just a macro that adds gtest, gmock, and gtestmain, and then runs addtest to create a test with the same name: targetlinklibraries (SimpleTest gtest gmock gtestmain) addtest (SimpleTest SimpleTest) FetchContent: CMake 3.11. I am having hard time trying to install Google C++ Mocking Framework. Project(SoftwareOccluder VERSION 0.1 LANGUAGES CXX) GTest exports the following targets: GTest::gtest GTest::gtestmain GTest::gmock GTest::gmockmain This targets should also be available when adding gtest with addsubdirectory (or FetchContent), because this should behave the same way as adding GTest with findpackage. $ treeĬmake_minimum_required(VERSION 3.5 FATAL_ERROR) I want to use CMake build system to compile it. Cmake_minimum_required (VERSION 3.I started working on a C++ project using Google Test framework for unit testing and header-only CImg library for internal operations.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |