[CMake] why do my targets keep rebuilding?

Benjamin Reed rangerrick at gmail.com
Wed Feb 13 16:51:15 EST 2008


So I'm trying to build some java stuff, and while it all works, it
appears my custom targets keep rebuilding.  For example, if I run a
cmake, and then make, it does what I expect (although the percentages
are off):

---(snip!)---
# make
[  0%] Generating org/opennms/protocols/icmp/AddressMaskReply.class,
org/opennms/protocols/icmp/AddressMaskRequest.class,
org/opennms/protocols/icmp/ErrorMessage.class,
org/opennms/protocols/icmp/ICMPEchoPacket.class,
org/opennms/protocols/icmp/ICMPHeader.class,
org/opennms/protocols/icmp/IcmpSocket.class,
org/opennms/protocols/icmp/TimestampReply.class,
org/opennms/protocols/icmp/TimestampRequest.class,
org/opennms/protocols/ip/IPHeader.class,
org/opennms/protocols/ip/IPv4Address.class,
org/opennms/protocols/ip/OC16ChecksumProducer.class,
org/opennms/protocols/ip/UnknownIPVersionException.class
added manifest
adding: org/(in = 0) (out= 0)(stored 0%)
adding: org/opennms/(in = 0) (out= 0)(stored 0%)
adding: org/opennms/protocols/(in = 0) (out= 0)(stored 0%)
adding: org/opennms/protocols/ip/(in = 0) (out= 0)(stored 0%)
adding: org/opennms/protocols/ip/IPHeader$LooseSourceRouteOption.class(in
= 735) (out= 368)(deflated 49%)
adding: org/opennms/protocols/ip/IPHeader$RouteRecordOption.class(in =
930) (out= 468)(deflated 49%)
adding: org/opennms/protocols/ip/OC16ChecksumProducer.class(in = 1256)
(out= 714)(deflated 43%)
adding: org/opennms/protocols/ip/UnknownIPVersionException.class(in =
409) (out= 286)(deflated 30%)
adding: org/opennms/protocols/ip/IPHeader$EndOfOptions.class(in = 501)
(out= 322)(deflated 35%)
adding: org/opennms/protocols/ip/IPHeader$Option.class(in = 820) (out=
513)(deflated 37%)
adding: org/opennms/protocols/ip/IPHeader$StrictSourceRouteOption.class(in
= 737) (out= 369)(deflated 49%)
adding: org/opennms/protocols/ip/IPHeader$RouteOption.class(in = 2017)
(out= 1085)(deflated 46%)
adding: org/opennms/protocols/ip/IPHeader.class(in = 8884) (out=
4149)(deflated 53%)
adding: org/opennms/protocols/ip/IPv4Address.class(in = 3305) (out=
1742)(deflated 47%)
adding: org/opennms/protocols/icmp/(in = 0) (out= 0)(stored 0%)
adding: org/opennms/protocols/icmp/IcmpSocket.class(in = 2283) (out=
1159)(deflated 49%)
adding: org/opennms/protocols/icmp/AddressMaskRequest.class(in = 1328)
(out= 844)(deflated 36%)
adding: org/opennms/protocols/icmp/TimestampRequest.class(in = 1825)
(out= 1087)(deflated 40%)
adding: org/opennms/protocols/icmp/TimestampReply.class(in = 2523)
(out= 1275)(deflated 49%)
adding: org/opennms/protocols/icmp/ErrorMessage.class(in = 1440) (out=
827)(deflated 42%)
adding: org/opennms/protocols/icmp/ICMPHeader.class(in = 5405) (out=
2500)(deflated 53%)
adding: org/opennms/protocols/icmp/ICMPEchoPacket.class(in = 3497)
(out= 1952)(deflated 44%)
adding: org/opennms/protocols/icmp/IcmpSocket$1.class(in = 1032) (out=
540)(deflated 47%)
adding: org/opennms/protocols/icmp/AddressMaskReply.class(in = 1627)
(out= 971)(deflated 40%)
adding: org/opennms/protocols/icmp/IcmpSocket$Logger.class(in = 273)
(out= 194)(deflated 28%)
[ 33%] Built target jicmp.jar
[ 66%] Generating org_opennms_protocols_icmp_IcmpSocket.h
Scanning dependencies of target jicmp
[100%] Building C object CMakeFiles/jicmp.dir/IcmpSocket.o
Linking C shared module libjicmp.so
[133%] Built target jicmp
---(snip!)---

...but if I do a make install, it regenerates the jar file and the .h
jni file, and then installs.

Any ideas what's going wrong?  My CMake files are here:

  http://opennms.svn.sourceforge.net/svnroot/opennms/jicmp/trunk/

Since CMake seems to have very little java support (other than finding
the JVM), I had to add my own targets to generate class files from
java files, and to generate the JNI .h file from the java.  I suspect
the problem is there, but I'm not sure what.

-- 
Benjamin Reed a.k.a. Ranger Rick
Fink, KDE, and Mac OS X development
http://www.racoonfink.com/


More information about the CMake mailing list