diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2017-08-03 02:13:30 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-03 02:13:30 (GMT) |
commit | 28bb854cefbaa2ff00e179ac1b864459464e3165 (patch) | |
tree | 301aa891da296d08055242bfd457f05c1980a8f7 | |
parent | fa388e9f94e21b96a315ed4298e75a2dd2fb6136 (diff) | |
parent | 5ff680577d3e6ed290e0b704ac5e349ed16aebf9 (diff) | |
download | googletest-28bb854cefbaa2ff00e179ac1b864459464e3165.zip googletest-28bb854cefbaa2ff00e179ac1b864459464e3165.tar.gz googletest-28bb854cefbaa2ff00e179ac1b864459464e3165.tar.bz2 |
Merge pull request #1042 from danilcha/patch-1
Added description of how to silence clang pedantic warnings in Google Mock includes
-rw-r--r-- | googlemock/README.md | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/googlemock/README.md b/googlemock/README.md index 7b13a6d..7efc068 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -125,13 +125,46 @@ build Google Mock and its tests, which has further requirements: ### Building Google Mock ### +#### Using CMake #### + If you have CMake available, it is recommended that you follow the [build instructions][gtest_cmakebuild] -as described for Google Test. If are using Google Mock with an +as described for Google Test. + +If are using Google Mock with an existing CMake project, the section [Incorporating Into An Existing CMake Project][gtest_incorpcmake] -may be of particular interest. Otherwise, the following sections -detail how to build Google Mock without CMake. +may be of particular interest. +To make it work for Google Mock you will need to change + + target_link_libraries(example gtest_main) + +to + + target_link_libraries(example gmock_main) + +This works because `gmock_main` library is compiled with Google Test. +However, it does not automatically add Google Test includes. +Therefore you will also have to change + + if (CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories("${gtest_SOURCE_DIR}/include") + endif() + +to + + if (CMAKE_VERSION VERSION_LESS 2.8.11) + include_directories(BEFORE SYSTEM + "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") + else() + target_include_directories(gmock_main SYSTEM BEFORE INTERFACE + "${gtest_SOURCE_DIR}/include" "${gmock_SOURCE_DIR}/include") + endif() + +This will addtionally mark Google Mock includes as system, which will +silence compiler warnings when compiling your tests using clang with +`-Wpedantic -Wall -Wextra -Wconversion`. + #### Preparing to Build (Unix only) #### |