[CMake] Problem with circular includes
Marc-André Laverdière
ma_laver at ciise.concordia.ca
Thu Jul 27 18:09:37 EDT 2006
Dear CMakers,
I'm working on an extension to the standard C library and I'm porting to
home-brew makefiles to CMake. Not making much progress so far.
It looks like one hurdle is that we use stuff like #include "stdio.h",
which contains some extra definitions and then an include to the real
<stdio.h>.
Here is the interesting part of the CMakeLists.txt file I use:
SUBDIRS(adapters stdio stdlib string test time wchar)
INCLUDE_DIRECTORIES(BEFORE . include stdio stdlib string test time wchar)
#add definitions, compiler switches, etc.
ADD_DEFINITIONS(-I- -pipe -Wall -W -O3 -std=c99 -posix
-D__STDC_WANT_LIB_EXT1__ 1)
Now, if I have the -I-, the compiler whines that it can't find the file
(especially that the newer version doesn't like -I-). I narrowed it down
to the #include "stdio.h".
Now, if I remove the -I-, I get a truckload of errors. My best guess is
that its trying to circularly find its include files withing mine.
The makefiles I manually coded in the past digested -I- very well, so
this is an unenjoyed obstacle.
My guess is that I could rename our .h files and hope that there are not
too many references to fix, but that's not a very tempting option.
How can I resolve this situation using CMake? Will it be really portable?
Is there an argument we can add in INCLUDE_DIRECTORIES to deal with the
situation cleanly (say, INCLUDE_DIRECTORIES(QUOTES ...) )?
With kind regards,
--
Marc-André LAVERDIÈRE, B. Eng., M. A. Sc. (in progress)
Research Assitant - Computer Security Laboratory
CIISE, Université Concordia University, Montréal, Québec, Canada
www.ciise.concordia.ca
/"\
\ / ASCII Ribbon Campaign
X against HTML e-mail
/ \
"Perseverance must finish its work so that you may be mature and
complete, not lacking anything." -James 1:4
More information about the CMake
mailing list