[CMake] How to decide between Release and Debug at ADD_DEFINITIONS for MSVC?

KSpam keesling_spam at cox.net
Wed Jul 30 13:16:48 EDT 2008


SirAnn,

Instead of add_definitions, you can simply append the desired flags to the 
compiler flags for the specific configuration.  For example:

set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE")

In the case of _SCL_SECURE_NO_WARNINGS and _CRT_SECURE_NO_DEPRECATE, I would 
think you would want these flags for all configurations (in which case, 
add_definitions would be the way to go).

Hope This Helps,
Justin

On Wednesday 30 July 2008 08:24:54 Sören Freudiger wrote:
> Hello
> I want to add "_SCL_SECURE_NO_WARNINGS" and "_CRT_SECURE_NO_DEPRECATE" at
> the MSVC Release configuration only.
> How can I do that?
>
> I found the open feature request:
>   http://www.vtk.org/Bug/view.php?id=6269
>
> Is there any workaround?
>
>   -SirAnn


More information about the CMake mailing list