[Cmake] custom target dependencies

Alexandre Laoubi alexandre . laoubi at thales-is . com
Tue, 24 Jun 2003 09:20:45 +0200


C'est un message de format MIME en plusieurs parties.

------=_NextPartTM-000-891805aa-a5ef-11d7-84ff-00306e1c2536
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0015_01C33A31.E417F650"

------=_NextPart_000_0015_01C33A31.E417F650
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,

after reading the manual, the faq and some cmake digests I decide to =
submit
this certainly quite simple problem : a custom target dependency on the =
main target.

I need that some .h and .c of my projet to be generated. They should be =
placed
in inc and src directories of basis. They are created in genextension =
directory
by the EOgenext executable. They depend of a descriptive file =
EXTFILE_STD.TXT
placed also in genextension dir.
Thus, my basis CMakeList.txt file contains the following statements :
ADD_CUSTOM_TARGET(updateEOglext ALL)SET(EXTFILE =
${EO_SOURCE_DIR}/genextension/EXTFILE_STD.TXT)ADD_CUSTOM_COMMAND( =
COMMAND ${EO_BINARY_DIR}/genextension/EOgenext ARGS -i EXTFILE_STD.TXT =
TARGET updateEOglext DEPENDS ${EXTFILE})ADD_CUSTOM_COMMAND(COMMAND cp  =
ARGS EOglext.h ${EO_SOURCE_DIR}/basis/inc TARGET updateEOglext =
)ADD_CUSTOM_COMMAND(COMMAND cp  ARGS EOglext.c =
${EO_SOURCE_DIR}/basis/src TARGET updateEOglext )
AUX_SOURCE_DIRECTORY(src SRCS)
ADD_LIBRARY(${LIB} ${SRCS})
ADD_DEPENDENCIES(${LIB} updateEOglext)
It produces the following makefile (extract) :
basis_DEPEND_LIBS =3D=20
#---------------------------------------------------------# static =
library#
libbasis.a: $(basis_SRC_OBJS)  $(basis_DEPEND_LIBS) echo "Building =
static library libbasis.a..." $(RM) libbasis.a /usr/bin/ar cr libbasis.a =
 $(basis_SRC_OBJS)   /usr/bin/ranlib libbasis.a  cp libbasis.* =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/cmakeEO/lib=20
#---------------------------------------------------------# Utility#
updateEOglext:  =
\/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/genextension/EXTFILE_STD.TXT echo =
"Building Utility updateEOglext..."   =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/cmakeEO/genextension/EOgenext -i =
EXTFILE_STD.TXT  cp EOglext.h =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/basis/inc  cp EOglext.c =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/basis/src=20
Unfortunately there is no dependency at all between the final target lib =
libbasis.a and updateEOglext.
I tried to express this dependency with UPDATE_DEPENDENCIES but...
Any way is there a mean to express the depency between the maintarget =
and a custom one ?

Thanks.

Alexandre Laoubi


------=_NextPart_000_0015_01C33A31.E417F650
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 5.50.4134.600" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>Hi,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>after reading the manual, the faq and =
some cmake=20
digests I decide to submit</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>this certainly quite simple problem : a =
custom=20
target dependency on the main target.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I need that some <EM>.h </EM>and <EM>.c =
</EM>of my=20
projet to be generated. They should be placed</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>in <EM>inc </EM>and <EM>src =
</EM>directories of=20
<EM>basis</EM>. They are created in <EM>genextension</EM> =
directory</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>by the <EM>EOgenext</EM> executable. =
They depend of=20
a descriptive file <EM>EXTFILE_STD.TXT</EM></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>placed also in <EM>genextension</EM>=20
dir.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Thus, my <EM>basis</EM> CMakeList.txt =
file contains=20
the following statements :</FONT></DIV>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE>ADD_CUSTOM_TARGET(updateEOglext ALL)<BR>SET(EXTFILE =
${EO_SOURCE_DIR}/genextension/EXTFILE_STD.TXT)<BR>ADD_CUSTOM_COMMAND(<BR>=
&nbsp;COMMAND ${EO_BINARY_DIR}/genextension/EOgenext<BR>&nbsp;ARGS -i =
EXTFILE_STD.TXT<BR>&nbsp;TARGET updateEOglext<BR>&nbsp;DEPENDS =
${EXTFILE}<BR>)<BR>ADD_CUSTOM_COMMAND(COMMAND cp&nbsp; ARGS EOglext.h =
${EO_SOURCE_DIR}/basis/inc<BR>&nbsp;TARGET updateEOglext =
)<BR>ADD_CUSTOM_COMMAND(COMMAND cp&nbsp; ARGS EOglext.c =
${EO_SOURCE_DIR}/basis/src<BR>&nbsp;TARGET updateEOglext =
)</PRE><PRE>AUX_SOURCE_DIRECTORY(src SRCS)</PRE><PRE>ADD_LIBRARY(${LIB} =
${SRCS})</PRE><PRE>ADD_DEPENDENCIES(${LIB} =
updateEOglext)</PRE></BLOCKQUOTE><FONT face=3DArial=20
size=3D2>
<DIV>It produces the following makefile (extract) :</DIV></FONT>
<BLOCKQUOTE dir=3Dltr style=3D"MARGIN-RIGHT: =
0px"><PRE><BR>basis_DEPEND_LIBS =3D =
</PRE><PRE>#---------------------------------------------------------<BR>=
# static library<BR>#</PRE><PRE>libbasis.a: $(basis_SRC_OBJS)&nbsp; =
$(basis_DEPEND_LIBS)<BR>&nbsp;echo "Building static library =
libbasis.a..."<BR>&nbsp;$(RM) libbasis.a<BR>&nbsp;/usr/bin/ar cr =
libbasis.a&nbsp; $(basis_SRC_OBJS)&nbsp; <BR>&nbsp;/usr/bin/ranlib =
libbasis.a <BR>&nbsp;cp libbasis.* =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/cmakeEO/lib =
</PRE><PRE>#---------------------------------------------------------<BR>=
# Utility<BR>#</PRE><PRE>updateEOglext:&nbsp; =
\<BR>/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/genextension/EXTFILE_STD.TXT<B=
R>&nbsp;echo "Building Utility updateEOglext..."<BR>&nbsp; =
<BR>&nbsp;/cygdrive/c/gina2/PUBLIC/ala/EOenv/cmakeEO/genextension/EOgenex=
t -i EXTFILE_STD.TXT <BR>&nbsp;cp EOglext.h =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/basis/inc <BR>&nbsp;cp EOglext.c =
/cygdrive/c/gina2/PUBLIC/ala/EOenv/EO/basis/src </PRE></BLOCKQUOTE><FONT =

face=3DArial size=3D2>
<DIV>Unfortunately there is no dependency at all between the final =
target lib=20
<EM>libbasis.a</EM>&nbsp;and <EM>updateEOglext.</EM></DIV>
<DIV>I tried to express this dependency with UPDATE_DEPENDENCIES =
but...</DIV>
<DIV>Any way is there a mean to express the depency between the =
maintarget and a=20
custom one ?</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Alexandre Laoubi</DIV>
<DIV></FONT>&nbsp;</DIV></BODY></HTML>

------=_NextPart_000_0015_01C33A31.E417F650--


------=_NextPartTM-000-891805aa-a5ef-11d7-84ff-00306e1c2536--