From b2521c890a8cf56830f9de0e0830311b30e7f61e Mon Sep 17 00:00:00 2001 From: danilcha Date: Sat, 11 Mar 2017 01:02:21 +0100 Subject: Update README.md --- googlemock/README.md | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/googlemock/README.md b/googlemock/README.md index 7b13a6d3..6fd9221a 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -125,13 +125,34 @@ 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. +The only modification you will need is to change + + target_link_libraries(example gtest_main) + +to + + target_link_libraries(example gmock_main) + +However, we also recommend adding the following lines (if using CMake 2.8.11 or later): + + target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") + target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + +This marks 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) #### -- cgit v1.2.3 From b6c4d434dbf41e8a83b808988f7a1cc95d4a5d39 Mon Sep 17 00:00:00 2001 From: danilcha Date: Sat, 11 Mar 2017 01:06:58 +0100 Subject: Update README.md --- googlemock/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/googlemock/README.md b/googlemock/README.md index 6fd9221a..af39548c 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -147,8 +147,8 @@ However, we also recommend adding the following lines (if using CMake 2.8.11 or target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") - target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") - target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") + target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") This marks Google Mock includes as system, which will silence compiler warnings when compiling your tests using clang with `-Wpedantic -Wall -Wextra -Wconversion`. -- cgit v1.2.3 From 81bc87652d40f1ad9e93650c0a4ba323b235f61d Mon Sep 17 00:00:00 2001 From: danilcha Date: Sun, 12 Mar 2017 17:47:14 +0100 Subject: Added explicit gtest library dependency --- googlemock/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/googlemock/README.md b/googlemock/README.md index af39548c..1259f776 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -141,7 +141,7 @@ The only modification you will need is to change to - target_link_libraries(example gmock_main) + target_link_libraries(example gtest gmock_main) However, we also recommend adding the following lines (if using CMake 2.8.11 or later): -- cgit v1.2.3 From 5ff680577d3e6ed290e0b704ac5e349ed16aebf9 Mon Sep 17 00:00:00 2001 From: danilcha Date: Sun, 12 Mar 2017 18:11:22 +0100 Subject: Again rewrote everything --- googlemock/README.md | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/googlemock/README.md b/googlemock/README.md index 1259f776..7efc0685 100644 --- a/googlemock/README.md +++ b/googlemock/README.md @@ -135,23 +135,35 @@ 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. -The only modification you will need is to change +To make it work for Google Mock you will need to change target_link_libraries(example gtest_main) to - target_link_libraries(example gtest gmock_main) - -However, we also recommend adding the following lines (if using CMake 2.8.11 or later): - - target_include_directories(gtest SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") - target_include_directories(gtest_main SYSTEM INTERFACE "${gtest_SOURCE_DIR}/include") - target_include_directories(gmock SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") - target_include_directories(gmock_main SYSTEM INTERFACE "${gmock_SOURCE_DIR}/include") - -This marks Google Mock includes as system, which will silence compiler warnings when -compiling your tests using clang with `-Wpedantic -Wall -Wextra -Wconversion`. + 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) #### -- cgit v1.2.3