2017-06-11 1 views
2

私はと一緒にテスト駆動型開発の最新のC++プログラミングを読んで、読者に Google Mock 1.6をインストールするよう指示しています。私はhereからソースをダウンロードしようとしています。そして、私はこの本によると: mkdir build cd build cmake .. makeGoogle Mock 1.6を設定する

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". 

../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 

私はREADMEを見て、私はこの問題を解決するのに役立ちます何もしていないようです。どんな助けや指導も最高!

答えて

0

hereのように、Google MockはGoogleTest projectに吸収されています。

GoogleTestをインストールする方法はさまざまです()。あなたはCMakeのを使用しているように見えるので、私はあなたにもCMakeLists.GTestにCMakeLists.txtに行くべきすべてのものを置くことができ、既存のcmakeのプロジェクト

中に、組み込む

の下であなたが手順に従ってください示唆し、 をCMakeLists.txtに入れてください。

GoogleTestの固定バージョンを決定したい場合は、GIT_TAGたとえばrelease-1.8.0´ instead of master`をCMakeLists.txt.inに使用することができます。

プロジェクトにGoogleTestを組み込んだ後、gtest/gtest.hFoo.hを含むFooTest.cppなどを作成して、クラスFooのgtestsを追加できます。そのため、あなたはまた、対応するCMakeLists.txtにadd_executable(FooTarget FooTest.cpp)target_link_libraries(FooTarget gtest)を配置する必要があります。

ます。また、このの簡単な説明を見つけることができる、とthese slidesにcTEST収録にGoogleTestsを統合する方法)。

関連する問題