Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
设置GoogleMock1.6 我试图跟上现代C++程序设计与测试驱动的发展,这样做,书指导读者安装。 谷歌模拟1.6。正在尝试这样做,我从下载源代码。然后根据我的书: mkdir构建 光盘制作 克马克。。 制造 myComputer:build me$ cmake .. -- The CXX compiler identification is AppleClang 8.0.0.8000042 -- The C compiler identification is AppleClang 8.0.0.8000042 -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done CMake Error at CMakeLists.txt:56 (add_subdirectory): add_subdirectory given source "../gtest" which is not an existing directory. CMake Error at CMakeLists.txt:61 (config_compiler_and_linker): Unknown CMake command "config_compiler_and_linker". -- Configuring incomplete, errors occurred! See also "/Users/me/Downloads/googlemock-release-1.6.0 3/build/CMakeFiles/CMakeOutput.log"._C++_Unit Testing_Cmake_Googlemock - Fatal编程技术网

设置GoogleMock1.6 我试图跟上现代C++程序设计与测试驱动的发展,这样做,书指导读者安装。 谷歌模拟1.6。正在尝试这样做,我从下载源代码。然后根据我的书: mkdir构建 光盘制作 克马克。。 制造 myComputer:build me$ cmake .. -- The CXX compiler identification is AppleClang 8.0.0.8000042 -- The C compiler identification is AppleClang 8.0.0.8000042 -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done CMake Error at CMakeLists.txt:56 (add_subdirectory): add_subdirectory given source "../gtest" which is not an existing directory. CMake Error at CMakeLists.txt:61 (config_compiler_and_linker): Unknown CMake command "config_compiler_and_linker". -- Configuring incomplete, errors occurred! See also "/Users/me/Downloads/googlemock-release-1.6.0 3/build/CMakeFiles/CMakeOutput.log".

设置GoogleMock1.6 我试图跟上现代C++程序设计与测试驱动的发展,这样做,书指导读者安装。 谷歌模拟1.6。正在尝试这样做,我从下载源代码。然后根据我的书: mkdir构建 光盘制作 克马克。。 制造 myComputer:build me$ cmake .. -- The CXX compiler identification is AppleClang 8.0.0.8000042 -- The C compiler identification is AppleClang 8.0.0.8000042 -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done CMake Error at CMakeLists.txt:56 (add_subdirectory): add_subdirectory given source "../gtest" which is not an existing directory. CMake Error at CMakeLists.txt:61 (config_compiler_and_linker): Unknown CMake command "config_compiler_and_linker". -- Configuring incomplete, errors occurred! See also "/Users/me/Downloads/googlemock-release-1.6.0 3/build/CMakeFiles/CMakeOutput.log".,c++,unit-testing,cmake,googlemock,C++,Unit Testing,Cmake,Googlemock,../gtest目录确实丢失。由于目录如下: CHANGES COPYING build include scripts CMakeLists.txt Makefile.am build-aux make src CONTRIBUTORS README configure.ac msvc test 更令人困惑的是这些说明: You will also need to build Google Test,

../gtest目录确实丢失。由于目录如下:

CHANGES     COPYING     build       include     scripts
CMakeLists.txt  Makefile.am build-aux   make        src
CONTRIBUTORS    README      configure.ac    msvc        test
更令人困惑的是这些说明:

You will also need to build Google Test, which is nested within Google Mock.

cd $GMOCK_HOME/gtest
mkdir mybuild
cd mybuild
cmake ..
make
我看了自述文件,似乎没有任何东西能帮助解决这个问题。任何帮助/指导都会非常棒

正如您所看到的,Google Mock已经被吸收到了应用程序中

安装GoogleTest有多种方法,如中所述。由于您似乎正在使用CMake,我建议您按照下面的步骤操作

合并到现有的CMake项目中

您还可以将应该进入CMakeLists.txt的所有内容放入CMakeLists.GTest,然后只将
include(CMakeLists.GTest)
放入CMakeLists.txt

如果您想确定应该合并的GoogleTest的固定版本,您可以使用
GIT_标签
eg
release-1.8.0',而不是CMakeLists.txt.in中的
master`

在项目中加入GoogleTest后,您可以通过创建包含
gtest/gtest.h
Foo.h
的eg FooTest.cpp来为类
Foo
添加gtest。因此,您还必须将
添加可执行文件(FooTarget FooTest.cpp)
目标链接库(FooTarget gtest)
放在相应的CMakeLists.txt中


您还可以找到关于这一点的简短描述,以及如何将GoogleTests集成到ctest on中。

您需要在gmock dir中安装gtest。 我最初和您有相同的错误,然后从中获取gtest版本1.6并将其放置在gmock root dir中并成功地构建了它