[CMake] DEBUG/RELEASE configurations for custom targets

Tyler Roscoe tyler at cryptio.net
Sun Sep 20 20:56:01 EDT 2009


On Sun, Sep 20, 2009 at 07:12:49PM -0500, Mike Howells wrote:
> I have a custom target that runs cppcheck. How do I specify different
> flags for different configurations? For example: I would like to specify
> "--all --style" when building DEBUG configuration, but not with RELEASE.
> 
> I can see how other built-in targets do this using things like
> CXX_FLAGS_DEBUG, and I can see how to use CMAKE_BUILD_TYPE in the case
> of a single-configuration generator. But how do you do it with a
> multi-configuration generator like the Visual Studio one? 

Take a look at CMAKE_CFG_INTDIR. VS will interpolate $(OutDir) when it
runs your custom command.

tyler


More information about the CMake mailing list