Re: Cygwin g++ for 'make depend'

Vadim Zeitlin <[email protected]>
Newsgroups gmane.comp.lib.wxwindows.general
Message-ID <[email protected]>
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/
signature.asc (application/pgp-signature, 195 B)
-----BEGIN PGP SIGNATURE-----

iF0EABECAB0WIQQx+vLQdOwioQqkxtoG6kHeT2wehgUCZcoM4gAKCRAG6kHeT2we
hiamAJ4r25RuqlV2uoyvMLojzTQ3yNknTQCePIE2AD0SpjXhtjeFlc8wMpgOZhs=
=NPjk
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.