tony@tony-virtual-machine:~/code/cmake/rpc$ cmake. -- The C compiler identification is GNU 7 .4. -- The CXX compiler identification is GNU 7 .4. -- 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 -- Configuring done -- Generating done -- Build files have been written to: /home/tony/code/cmake/rpc
ls查看目录,发现除了CMake生成的一些中间文件,还生成好了Makefile文件
1 2
tony@tony-virtual-machine:~/code/cmake/rpc$ ls CMakeCache.txt CMakeFiles cmake_install.cmake CMakeLists.txt main.cpp Makefile
make开始编译,最终生成可执行文件main
1 2 3 4 5
tony@tony-virtual-machine:~/code/cmake/rpc$ make Scanning dependencies of target main [ 50 %] Building CXX object CMakeFiles/main.dir/main.cpp.o [100%] Linking CXX executable main [100%] Built target main
查看生成的可执行文件:
1 2
tony@tony-virtual-machine:~/code/cmake/rpc$ ls CMakeCache.txt CMakeFiles cmake_install.cmake CMakeLists.txt main main.cpp Makefile
tony@tony-virtual-machine:~/code/cmake/rpc/build$ cmake .. -- The C compiler identification is GNU 7 .4. -- The CXX compiler identification is GNU 7 .4. -- 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 -- Configuring done -- Generating done -- Build files have been written to: /home/tony/code/cmake/rpc/build tony@tony-virtual-machine:~/code/cmake/rpc/build$ make Scanning dependencies of target main [ 25 %] Building CXX object CMakeFiles/main.dir/main.cpp.o [ 50 %] Building CXX object CMakeFiles/main.dir/src/minor.cpp.o [ 75 %] Building CXX object CMakeFiles/main.dir/src/sum.cpp.o [100%] Linking CXX executable ../bin/main [100%] Built target main tony@tony-virtual-machine:~/code/cmake/rpc$ cd bin/ tony@tony-virtual-machine:~/code/cmake/rpc/bin$ ls main