How do I compile a java project with cmake? -


as understand, cmake supports java since version 2.8.6. have found command add_jar can't seem work. cmakelists.txt looks this:

cmake_minimum_required(version 2.8.10) find_package(java)  file(glob source     "${cmake_current_source_dir}/*.java" )  add_jar(hello ${source}) 

and when run cmake this:

-- c compiler identification gnu 4.7.3 -- cxx compiler identification gnu 4.7.3 -- check working c compiler: /usr/bin/cc -- check working c compiler: /usr/bin/cc -- works -- detecting c compiler abi info -- detecting c compiler abi info - done -- check working cxx compiler: /usr/bin/c++ -- check working cxx compiler: /usr/bin/c++ -- works -- detecting cxx compiler abi info -- detecting cxx compiler abi info - done -- found java: /usr/bin/java (found version "1.7.0.25")  cmake error @ cmakelists.txt:8 (add_jar):   unknown cmake command "add_jar".   -- configuring incomplete, errors occurred! 

what missing here?

you have include usejava module well.

find_package(java) include(usejava)  add_jar(hello ${source}) 

the find_package call determines location of java installation on disk, while usejava module provides functions using java (like add_jar). stated documentation, former prerequisite loading latter.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -