I'm trying to create a JNI jar with CMake. For that the following has to be done in the appropriate order:
- compile .class files
- generate .h headers
- build native library
- jar everything
where
- is done with
add_jar()(I prefered that at custom_command) - is done with
add_custom_command(TARGET ...) - is done with
add_library() - is done with
add_custom_command(TARGET ...)(because -C option is not supported by add_jar)
How can I ensure that the proper order is followed? I get errors sometimes on the first run.
add_custom_command has a POST/PRE build option, but add_jar and add_library does not. The add_custom_command that does not have the argument TARGET has the DEPENDS option, should I use that?
Is there a way of telling add_library to wait for the 2. custom command to have been ran?