On Mon, 12 Feb 2024 03:00:16 -0800 (PST) Gisle Vanem wrote:
GV> In my a GNU-makefile (targeting MSVC), I sometimes use a Cygwin 'g++'
GV> to create dependencies. Like:
GV> DEP_CFLAGS = -MM $(filter -I% -D%, $(CFLAGS)) \
GV> --include $(OBJ_DIR)/config.h \
GV> -DGCC_MAKE_DEPEND
GV> depend:
GV> g++ $(DEP_CFLAGS) $(SOURCE) >> .depend.Windows
Note that this is not going to work for anything conditionally-included
depending on the compiler used.
GV> But when a wxWidget headers notice a '__GNUC__' and/or '__CYGWIN__' is
GV> involved,
GV> it goes bananas with huge amounts of '#error' statements.
I guess it's due to filtering out -D__WXMSW__ from your CFLAGS above, why
do you do it?
GV> So I just fake 'g++' into a MSVC-compiler in my generated
GV> '$(OBJ_DIR)/config.h':
GV> #if defined(GCC_MAKE_DEPEND)
GV> #define _MSC_VER 1910
GV> #define WX CHKCONF H 1
GV> #define WX MSW CHKCONF H 1
GV> #define __WXMSW__ 1
GV> #endif
GV> ....
GV> --------------
GV>
GV> Is there a better way?
You could predefine the same symbols on command line, but it's still a
dirty hack, of course.
Regards,
VZ
--
TT-Solutions: wxWidgets consultancy and technical support
https://www.tt-solutions.com/