-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (41 loc) · 1.22 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#versioning for libelektra.jar
set(CMAKE_JAVA_TARGET_VERSION ${KDB_VERSION})
find_package(Java)
include(UseJava)
if (CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 8)
if (CMAKE_PATCH_VERSION LESS 11)
#2.8.11 needed for add_jar INCLUDE_JARS
remove_binding(jna "cmake 2.8.11 needed for add_jar")
return()
endif()
endif()
if (Java_VERSION_MAJOR GREATER 0 AND Java_VERSION_MINOR GREATER 7)
file(GLOB files elektra/*.java)
file(GLOB pfiles elektra/plugin/*.java)
# find_jar(<VAR>
# name | NAMES name1 [name2 ...]
# [PATHS path1 [path2 ... ENV var]]
# [VERSIONS version1 [version2]]
# [DOC "cache documentation string"]
# )
find_jar(jna
NAMES jna
PATHS /usr/share/java
)
if (jna)
# should work, too
# http://www.cmake.org/cmake/help/v3.0/module/UseJava.html
#set(CMAKE_JAVA_INCLUDE_PATH ${jna})
add_jar(libelektra
INCLUDE_JARS ${jna}
SOURCES ${files} ${pfiles}
VERSION 1
OUTPUT_NAME libelektra
)
install_jar(libelektra share/java)
else(jna)
remove_binding(jna "jna jar file not found, searched in standard paths and /usr/share/java")
endif(jna)
else()
remove_binding(jna "Java is not greater version 8, but ${Java_VERSION} was found")
endif()