[CMake] Re: [vtk-developers] deprecated CRT routines in MSVS8
David Cole
david.cole at kitware.com
Wed Aug 3 14:00:47 EDT 2005
How about a "pre-defined" CMake macro that's a one-liner for turning
this "feature" on or off. And not using it at all by default... (i.e. -
if you're using Visual Studio 8, you should get Visual Studio 8 behavior
by default : most secure, most verbose)
That way, we can use the CMake macro in projects that make heavy use of
strcpy and friends to avoid the warnings, but people converting old
projects without knowledge of these warnings will get them at first and
then hopefully find our one line macro if they don't feel like changing
MAX_INT lines of code... :-)
Or if not a macro, at least a .cmake script that can be included by a
one-liner to turn the warnings on or off...
Even more thoughts?
David
Brad King wrote:
> Yianis Nikolaou wrote:
>
>> I have to agree with Amitha because
>> IMHO the activation/deactivation of these warnings
>> should be left for the developer to decide explicitly,
>> and this can be handled easily with the addition of a line like
>>
>> ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE)
>> in the CMakeList.txt file.
>
>
> The problem with this approach is that there are something like 10
> different macros that need to be defined to "fix" everything:
>
> _CRT_FAR_MAPPINGS_NO_DEPRECATE
> _CRT_IS_WCTYPE_NO_DEPRECATE
> _CRT_MANAGED_FP_NO_DEPRECATE
> _CRT_NONSTDC_NO_DEPRECATE
> _CRT_SECURE_NO_DEPRECATE
> _CRT_SECURE_NO_DEPRECATE_GLOBALS
> _CRT_SETERRORMODE_BEEP_SLEEP_NO_DEPRECATE
> _CRT_TIME_FUNCTIONS_NO_DEPRECATE
> _CRT_VCCLRIT_NO_DEPRECATE
> _SCL_SECURE_NO_DEPRECATE
>
> although some of these probably shouldn't be defined. Most projects
> will probably define at least _CRT_SECURE_NO_DEPRECATE and
> _SCL_SECURE_NO_DEPRECATE. We could define a CMake variable like
>
> SET(CMAKE_MSVC_NO_DEPRECATE_LIST
> _CRT_SECURE_NO_DEPRECATE
> _SCL_SECURE_NO_DEPRECATE
> # ...
> )
>
> that is used by the generator to add the desired set of definitions.
> The common list would be the default. Then projects that want the
> deprecation could change the list or set it to empty:
>
> SET(CMAKE_MSVC_NO_DEPRECATE_LIST)
>
> In this way CMake helps provide a cross-platform "standard" C and C++
> implementation.
>
>> or by
>> # pragma warning ( disable : 4996 ) /* depreciated functions */
>> in a header file as Goodwin suggested.
>
>
> This solution is not a good idea because it disables deprecation
> warnings for ALL functions/methods, not just the CRT ones. For many
> projects these warnings should remain on.
>
> -Brad
> _______________________________________________
> vtk-developers mailing list
> vtk-developers at vtk.org
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>
More information about the CMake
mailing list