据我了解,cmake 从 2.8.6 版开始支持 java。我找到了命令 add_jar 但我似乎无法让它工作。我的 CMakeLists.txt 看起来像这样:
cmake_minimum_required(VERSION 2.8.10)
find_package(Java)
FILE(GLOB source
"${CMAKE_CURRENT_SOURCE_DIR}/*.java"
)
add_jar(hello ${source})
当我运行 cmake 时,我得到了这个:
-- The C compiler identification is GNU 4.7.3
-- The CXX compiler identification is GNU 4.7.3
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for 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 at CMakeLists.txt:8 (add_jar):
Unknown CMake command "add_jar".
-- Configuring incomplete, errors occurred!
我在这里想念什么?