cmake构建
#CMAKE官网教程
https://cmake.org/cmake-tutorial/
#CMAKE 构建eclipse项目
mkdir build_eclipse cd build_elipse cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../my_project
#CMAKE 设置Build Type (Debug/Release)
cmake -DCMAKE_BUILD_TYPE=Debug ..
怎样区分debug、release版本
建立debug/release两目录,分别在其中执行cmake -DCMAKE_BUILD_TYPE=Debug(或Release),需要编译不同版本时进入不同目录执行make即可;
Debug版会使用参数-g;Release版使用-O3 –DNDEBUG另一种设置方法——例如DEBUG版设置编译参数DDEBUG
IF(DEBUG_mode)
add_definitions(-DDEBUG)
ENDIF()
在执行cmake时增加参数即可,例如cmake -D DEBUG_mode=ON
#指定CMAKE构建32位/64位版本的程序
GCC (on Linux) and some other compilers, e.g Sun Studio. Set CFLAGS and CXXFLAGS to include -m32 (32-bit build) or -m64 (64-bit build).
Finally, cmake “-DCMAKE_OSX_ARCHITECTURES=x86_64;i386” /path/to/source/dir will create 96-bit universal binaries 😃
posted on 2017-02-10 11:12 qq575654643 阅读(121) 评论(0) 收藏 举报