[CMake] Building java files from cmake

ankit jain ankitguddu at gmail.com
Fri Mar 20 06:15:02 EDT 2009


2009/3/20 Mattias Helsing <helsing72 at gmail.com>

> Hi Ankit,
>
> I have no xp with cmake for java. I was just pointing out my first
> immediate reaction to your script code.
>
> Perhaps you should try things in smaller scale, e.g. try to create a
> custom_command that compiles one java file. Also - during development
> I often use the message command (printf debugging), i.e.
> message("MYVAR ${MYVAR}")
>
> cheers
>  Mattias
>
> No problem. Thanks anyways  for the support
>

Ankit

>
> On 3/20/09, ankit jain <ankitguddu at gmail.com> wrote:
> > 2009/3/20 Mattias Helsing <helsing72 at gmail.com>
> >
> >> Hi Ankit,
> >>
> >> The set command doesn't work like you think.
> >> set(X a b c) creates a list called X with contents a;b;c. So you have
> the
> >> list
> >> JAVADIST with contents
> >> (/myjava/jdk/1.4.2/Linux/;XERCESDIR;/myjava/XML4J/4.3.4)
> >>
> >> try
> >> set(JAVADIST /myjava/jdk/1.4.2/Linux/ )
> >> set(XERCESDIR /myjava/XML4J/4.3.4 )
> >>
> >
> > Still it does not work means not creating class files. No errors are
> > generated but .class files are not genrated.
> > I feel there might be a problem with CLASSPATH,
> > But also i try by explicitly set them. It doesnt work.
> >
> > Check this link:
> > http://www.mail-archive.com/cmake@cmake.org/msg16764.html
> >
> > Iam not getting whatever given in this link. How to use it i dont know.
> > Ankit
> >
> >>
> >> Mattias
> >>
> >>
> >> On 3/20/09, ankit jain <ankitguddu at gmail.com> wrote:
> >> > Hi all,
> >> >
> >> > I have a folder "mainfolder" with sufolder "innerfolder" which has
> soem
> >> java
> >> > files. i want to create it class files. for that iam using
> >> add_sutom_command
> >> > to run the javac command but still my class files are not generated.
> >> >
> >> > The content of cmakelist of mainfolder is:
> >> > project(mainfolder)
> >> > cmake_minimum_required(VERSION 2.4.0)
> >> > add_subdirectory(innerfolder)
> >> >
> >> >  The content of cmakelist of innerfolder is:
> >> >
> >> > set(
> >> >         JAVADIST /myjava/jdk/1.4.2/Linux/
> >> >         XERCESDIR /myjava/XML4J/4.3.4
> >> >      )
> >> > include_directories(${JAVADIST} ${XERCESDIR})
> >> > include_directories(${CMAKE_CURRENT_SOURCE_DIR})
> >> > set(JAVADIR $(JAVADIST)/bin)
> >> > set(
> >> >         JAVAJRE $(JAVADIST)/jre
> >> >         JAVAC $(JAVADIR)/javac
> >> >         JAVA $(JAVADIR)/java
> >> > )
> >> > set(CLASSPATH
> >> >
> >>
> $(CMAKE_CURRENT_SOURCE_DIR):$(XERCESDIR)/xmlParserAPIs.jar:$(XERCESDIR)/xercesImpl.jar)
> >> > set(innerfolder_srcs
> >> >         Myprogram.java
> >> > )
> >> > ADD_CUSTOM_COMMAND(OUTPUT  ${innerfolder_srcs}
> >> >                COMMAND ${JAVAC} ARGS -classpath ${CLASSPATH}
> >> > ${innerfolder_srcs}
> >> > )
> >> >
> >> >
> >> > I dont know where iam doing something wrongdue to which class files
> for
> >> the
> >> > specifed source java file is not genrated..
> >> >
> >> > Please guide me..
> >> >
> >> > Ankit
> >> >
> >>
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090320/32e31939/attachment.htm>


More information about the CMake mailing list