aboutsummaryrefslogtreecommitdiff
path: root/samples/basic/basic-native/src/CMakeLists.txt
blob: ec112b37bc3be248019c4128436205836ef0db48 (plain) (blame)
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
cmake_minimum_required(VERSION 2.6)

# Define project and related variables
#
project (demo)

# Set versions and library name
# Note: major version will be appended to library name
#
set (VERSION_MAJOR 1)
set (VERSION_MINOR 2)
set (VERSION_PATCH 3)
set (LIB_NAME demo${VERSION_MAJOR})

# Command-line options
#
# required by sbt-jni to install binaries to correct places
set (LIB_INSTALL_DIR lib CACHE PATH "Path in which to install libraries (Autoconf equivalent to --libdir).")
# required by sbt-jni to disable versioned libraries
set (ENABLE_VERSIONED_LIB ON CACHE BOOLEAN "Generate versioned library files and symlinks.")

# Setup JNI
find_package(JNI REQUIRED)
if (JNI_FOUND)
    message (STATUS "JNI include directories: ${JNI_INCLUDE_DIRS}")
endif()

# Include directories
include_directories(.)
include_directories(include)
include_directories(${JNI_INCLUDE_DIRS})

# Setup main shared library
# Note: major version is appended to library name
add_library(${LIB_NAME} SHARED library.c)
if (ENABLE_VERSIONED_LIB)
   set_target_properties(
	${LIB_NAME}
	PROPERTIES
	VERSION 0.${VERSION_MINOR}.${VERSION_PATCH} # major version always 0, it is included in name
	SOVERSION 0
   )
endif()

# Installation targets
install(TARGETS ${LIB_NAME} LIBRARY DESTINATION ${LIB_INSTALL_DIR})