常用 Cmake 命令和参数
在 linux 平台下使用 CMake 生成 Makefile 并编译的流程如下:
- 编写 CMake 配置文件 CMakeLists.txt 。
- 执行命令 cmake PATH 或者 ccmake PATH 生成 Makefile(ccmake 和 cmake 的区别在于前者提供了一个交互式的界面)。其中, PATH 是 CMakeLists.txt 所在的目录。
- 使用 make 命令进行编译。
命令
- cmake_minimum_required
- configure_file()
- option ()
- include_dictionaries
- add_subdictionary
- set ()
- aux_source_directory(. DIR_SRCS)
- add_executable(Demo ${DIR_SRCS})
- target_link_libraries(Demo ${EXTRA_LIBS})
 
                     
                    
                 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号