how to ask cmake to clean Release configuration for Msvc build
I have build tree for different compilers (msvc-2008, mingw-gcc), generated with CMake:
\---buildroot
\---win32
+---mingw-gcc-4.4.0
| +---Debug
| \---Release
\---msvc-2008
+---Debug_Dynamic
+---Debug_Static
+---Release_Dynamic
\---Release_Static
And i want to build all configurations with one script. I wrote simple python wrapper, which iterates over hierarchy and calls cmake --build. For msvc builds i need to select proper configuration for building, cleaning and installing
I read documentation, and find parameter --config
.
So final cmake command looks like:
cmake --build win32\mingw-gcc-4.4.0\Debug
cmake --build win32\mingw-gcc-4.4.0\Release
cmake --build win32\msvc-2008\Debug_Dynamic --config Debu开发者_Go百科g
cmake --build win32\msvc-2008\Debug_Static --config Debug
cmake --build win32\msvc-2008\Release_Dynamic --config Release
cmake --build win32\msvc-2008\Release_Static --config Release
Here cmake commands for clean all targets:
cmake --build win32\mingw-gcc-4.4.0\Debug --target clean
cmake --build win32\mingw-gcc-4.4.0\Release --target clean
cmake --build win32\msvc-2008\Debug_Dynamic --config Debug --target clean
cmake --build win32\msvc-2008\Debug_Static --config Debug --target clean
cmake --build win32\msvc-2008\Release_Dynamic --config Release --target clean
cmake --build win32\msvc-2008\Release_Static --config Release --target clean
So i found answer on my question.
Disclaimer: I must admit that I do not know much about the --build option for Cmake. However, cmake also generates a 'package' and 'install' target, perhaps you can specify those with the --target option with cmake --build.
cmake --build my_build_dir --target install
Otherwise, you will need to specify those using devenv or msbuild command line options. Without cmake this woule be something like
devenv INSTALL.vcproj /Build Release
devenv INSTALL.vcproj /Clean Release
msbuild INSTALL.vcproj /t:Build /p:Configuration=Release
msbuild INSTALL.vcproj /t:Clean /p:Configuration=Release
I guess you can pass everything after msbuild/devenv through to cmake with '--'
精彩评论