I think I've found the problem, but haven't properly solved it.
I am using -DCMAKE_CXX_FLAGS_RELEASE="/MT" and -DCMAKE_CXX_FLAGS_DEBUG="/MTd" and the C versions of these flags to specify static linkage. I found that adding /DNDEBUG to the release versions of the flags cured my problem.
However I've also recently tried building with unicode enabled, but using -DCMAKE_CXX_FLAGS="/D UNICODE /D _UNICODE". this caused me build errors that I narrowed down to not having WIN32 defined!
It seems that defining these flags on the command line is overriding the "normal" linker flags rather than adding to them. am I doing something wrong and is there a better way to do this?

From: Arjen Markus <arjen.markus@deltares.nl>
To: phil rosenberg <philip_rosenberg@yahoo.com>; "plplot-devel@lists.sourceforge.net" <plplot-devel@lists.sourceforge.net>
Sent: Wednesday, 29 August 2012, 14:54
Subject: Re: [Plplot-devel] Building examples on Windows

On Wed, 29 Aug 2012 06:45:08 -0700 (PDT)
phil rosenberg <philip_rosenberg@yahoo.com> wrote:


> Secondly, when I try to build the examples in release mode i get problems with undefined symobls to do with wxAssert. As you might expect these calls are all inside #ifdefs and should only be called in debug mode. So it appears that somewhere _DEBUG or __wxDEBUG__ is being defined in the release build.

Have you checked the .vcproj files for occurrences of
_DEBUG or __wxDEBUG__? That might give you a clue as to
where this is coming from. Unfortunately, each one will
have that symbol for the Debug configuration, so it is
a bit of a pain.

(__wxDEBUG__ ought to exist in only a very small number of



DISCLAIMER: This message is intended exclusively for the addressee(s) and may contain confidential and privileged information. If you are not the intended recipient please notify the sender immediately and destroy this message. Unauthorized use, disclosure or copying of this message is strictly prohibited.
The foundation 'Stichting Deltares', which has its seat at Delft, The Netherlands, Commercial Registration Number 41146461, is not liable in any way whatsoever for consequences and/or damages resulting from the improper, incomplete and untimely dispatch, receipt and/or content of this e-mail.