Quoting Benjamin Reed <[EMAIL PROTECTED]>:
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,
[...]
[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.
The problem is you are using ADD_CUSTOM_TARGET for the .jar. Line 112
in your CMakeLists.txt:
add_custom_target(jicmp.jar ${JAVA_ARCHIVE} -cvf jicmp.jar org DEPENDS
${JAVA_CLASS_FILES} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
According to the CMake docs, ADD_CUSTOM_TARGET is considered always
out of date and rebuilt:
$ cmake --help ADD_CUSTOM_TARGET
ADD_CUSTOM_TARGET
Add a target with no output so it will always be built.
ADD_CUSTOM_TARGET(Name [ALL] [command1 [args1...]]
[COMMAND command2 [args2...] ...]
[DEPENDS depend depend depend ... ]
[WORKING_DIRECTORY dir]
[COMMENT comment] [VERBATIM])
Adds a target with the given name that executes the given commands.
The target has no output file and is ALWAYS CONSIDERED OUT OF DATE
even if the commands try to create a file with the name of the target.
Use ADD_CUSTOM_COMMAND.
--
Pau Garcia i Quiles
http://www.elpauer.org
(Due to my workload, I may need 10 days to answer)
_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake