lansh

首页 新随笔 联系 订阅 管理
How can I build multiple modes without switching ?

To build multiple modes (e.g. Debug and Release) in one shot without constantly running cmake -DCMAKE_BUILD_TYPE=Debug and cmake -DCMAKE_BUILD_TYPE=Release in source tree create a directory for builds eg.:

Project-directory/
  /Build

Inside you can place as many target directories for out-of-source build modes as you want, e.g.:

Project-directory/
  /Build
    /Debug
    /Release

In each of these directories issue a command (assuming that you have CMakeLists.txt directly in Project-directory)

cmake -DCMAKE_BUILD_TYPE=type_of_build ../../

to create a cmake cache configured for requested build type.

Now you can make each build just by entering appropriate directory and executing a make command.

到这里为止,应该可以将所有的零时文件产生到各自目录里面了。但是实际运行情况却还是老样子,还是产生到了根目录。通过上网查找,发现了一个可能因素:CMakeCache.txt文件。

于是将根目录下面的这个文件删除掉,OK,一切正常了,产生到了预期位置。

posted on 2010-02-08 14:59  lansh  阅读(1926)  评论(0编辑  收藏  举报