-- The C compiler identification is GNU 7.5.0-- The CXX compiler identification is GNU 7.5.0-- Check for working C compiler: /usr/bin/cc-- Check for working C compiler: /usr/bin/cc - works-- Detecting C compiler ABI info-- Detecting C compiler ABI info - done-- Detecting C compile features-- Detecting C compile features - done-- Check for working CXX compiler: /usr/bin/c++-- Check for working CXX compiler: /usr/bin/c++ - works-- Detecting CXX compiler ABI info-- Detecting CXX compiler ABI info - done-- Detecting CXX compile features-- Detecting CXX compile features - done-- Found PythonInterp: /usr/bin/python3.6 (found version "3.6.9")-- Looking for pthread.h-- Looking for pthread.h - found-- Performing Test CMAKE_HAVE_LIBC_PTHREAD-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed-- Looking for pthread_create in pthreads-- Looking for pthread_create in pthreads - not found-- Looking for pthread_create in pthread-- Looking for pthread_create in pthread - found-- Found Threads: TRUE-- Configuring done-- Generating done-- Build files have been written to: /d/code/IndexProject/build
然后使用 make 编译生成我们需要的东西,可以使用
make all
生成所有的。
Scanning dependencies of target IndexProject_lib
[ 5%] Building CXX objectsrc/CMakeFiles/IndexProject_lib.dir/Formula.cpp.o[ 11%] Building CXX objectsrc/CMakeFiles/IndexProject_lib.dir/main.cpp.o[ 17%] Linking CXX static library libIndexProject_lib.a[ 17%] Built target IndexProject_lib
Scanning dependencies of target IndexProject_run
[ 23%] Building CXX objectsrc/CMakeFiles/IndexProject_run.dir/Formula.cpp.o[ 29%] Building CXX objectsrc/CMakeFiles/IndexProject_run.dir/main.cpp.o[ 35%] Linking CXX executable IndexProject_run
[ 35%] Built target IndexProject_run
Scanning dependencies of target gtest
[ 41%] Building CXX object lib/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o[ 47%] Linking CXX static library ../../libgtestd.a[ 47%] Built target gtest
Scanning dependencies of target IndexProject_tst
[ 52%] Building CXX object tst/CMakeFiles/IndexProject_tst.dir/Formula-test.cpp.o[ 58%] Building CXX object tst/CMakeFiles/IndexProject_tst.dir/main.cpp.o[ 64%] Linking CXX executable IndexProject_tst
[ 64%] Built target IndexProject_tst
Scanning dependencies of target gmock
[ 70%] Building CXX object lib/googletest/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o[ 76%] Linking CXX static library ../../libgmockd.a[ 76%] Built target gmock
Scanning dependencies of target gmock_main
[ 82%] Building CXX object lib/googletest/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o[ 88%] Linking CXX static library ../../libgmock_maind.a[ 88%] Built target gmock_main
Scanning dependencies of target gtest_main
[ 94%] Building CXX object lib/googletest/googletest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o[100%] Linking CXX static library ../../libgtest_maind.a[100%] Built target gtest_main
[ 12%] Building CXX objectsrc/CMakeFiles/IndexProject_lib.dir/Formula.cpp.o[ 25%] Building CXX objectsrc/CMakeFiles/IndexProject_lib.dir/main.cpp.o[ 37%] Linking CXX static library libIndexProject_lib.a[ 37%] Built target IndexProject_lib
[ 50%] Building CXX object lib/googletest/googletest/CMakeFiles/gtest.dir/src/gtest-all.cc.o[ 62%] Linking CXX static library ../../libgtestd.a[ 62%] Built target gtest
[ 75%] Building CXX object tst/CMakeFiles/IndexProject_tst.dir/Formula-test.cpp.o[ 87%] Building CXX object tst/CMakeFiles/IndexProject_tst.dir/main.cpp.o[100%] Linking CXX executable IndexProject_tst
[100%] Built target IndexProject_tst
[ 33%] Building CXX objectsrc/CMakeFiles/IndexProject_run.dir/Formula.cpp.o[ 66%] Building CXX objectsrc/CMakeFiles/IndexProject_run.dir/main.cpp.o[100%] Linking CXX executable IndexProject_run
[100%] Built target IndexProject_run
找到我们生成的可执行文件
$ find . -executable -type f -name "IndexProject*"
./src/IndexProject_run
./tst/IndexProject_tst
$ ./src/IndexProject_run;./tst/IndexProject_tst
Bla: 4
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from blaTest
[ RUN ] blaTest.test1
/d/code/IndexProject/tst/Formula-test.cpp:9: Failure
Expected equality of these values:
Formula::bla(4)
Which is: 8
[ FAILED ] blaTest.test1 (1 ms)
[----------] 1 test from blaTest (2 ms total)
[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (3 ms total)
[ PASSED ] 0 tests.
[ FAILED ] 1 test, listed below:
[ FAILED ] blaTest.test1
1 FAILED TEST