tzloop@tzloop-GE62-6QC:~/Desktop/test1$ tree -C -L 2 . ├── bin ├── build ├── CMakeLists.txt ├── include │ ├── testFunc1.h │ └── testFunc.h └── src ├── CMakeLists.txt ├── main.cpp ├── testFunc1.cpp └── testFunc.cpp
构建项目的步骤如下:
1 2 3 4 5 6
tzloop@tzloop-GE62-6QC:~/Desktop/test1$ cd build/ tzloop@tzloop-GE62-6QC:~/Desktop/test1/build$ cmake .. ... ... -- Configuring done -- Generating done -- Build files have been written to: /home/tzloop/Desktop/test1/build
会发现:
在build文件夹下已经出现一众的Cmake文件的src文件夹
并生成了Makefile文件,这是我们接下来进行cmake的保证
对于CmakeCache.txt,如果我们要重新cmake,则需要删除之
1 2 3 4 5 6 7
tzloop@tzloop-GE62-6QC:~/Desktop/test1/build$ make Scanning dependencies of target main [ 25%] Building CXX object src/CMakeFiles/main.dir/main.cpp.o [ 50%] Building CXX object src/CMakeFiles/main.dir/testFunc.cpp.o [ 75%] Building CXX object src/CMakeFiles/main.dir/testFunc1.cpp.o [100%] Linking CXX executable ../../bin/main [100%] Built target main
tzloop@tzloop-GE62-6QC:~/Desktop/rmmartins-cubu-ee034cafdaa2$ mkdir -p build && cd build && cmake .. && make install -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.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 OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so -- Found GLUT: /usr/lib/x86_64-linux-gnu/libglut.so CMake Error at /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find GLUI (missing: GLUI_INCLUDE_DIR GLUI_LIBRARY) Call Stack (most recent call first): /usr/share/cmake-3.10/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) cmake/FindGLUI.cmake:106 (find_package_handle_standard_args) CMakeLists.txt:8 (find_package)
-- Configuring incomplete, errors occurred! See also "/home/tzloop/Desktop/rmmartins-cubu-ee034cafdaa2/build/CmakeFiles/CmakeOutput.log".
vis.cpp:343:2: error: use of undeclared identifier 'glGenFramebuffersEXT' glGenFramebuffersEXT(2,framebuffers); //Make t... ^ vis.cpp:347:2: error: use of undeclared identifier 'glBindFramebufferEXT' glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebuffer_lum); ^ vis.cpp:352:2: error: use of undeclared identifier 'glFramebufferTexture2DEXT' glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT... ^ vis.cpp:354:2: error: use of undeclared identifier 'glBindFramebufferEXT' glBindFramebufferEXT(GL_FRAMEBUFFER_EXT,framebuffer_rgba); ^ vis.cpp:359:2: error: use of undeclared identifier 'glFramebufferTexture2DEXT' glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_COLOR_ATTACHMENT... ^ ... ...