CMakeLists.txt 1.39 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
cmake_minimum_required(VERSION 3.18.0)

project(cameo-server-jzmq
  VERSION 1.0.2
  HOMEPAGE_URL "https://code.ill.fr/cameo/cameo"
  )

include(GNUInstallDirs)

if(NOT DEFINED CMAKE_BUILD_TYPE)
  set(CMAKE_BUILD_TYPE Relase)
endif()

# find the jar file produced by MAVEN
set(PROJECT_TARGET_DIR "${CMAKE_CURRENT_SOURCE_DIR}/target")
set(PROJECT_JAR ${PROJECT_TARGET_DIR}/${PROJECT_NAME}${JAVA_JZMQ}-${PROJECT_VERSION}-full.jar)

set(JAVA_INSTALL_DIR ${CMAKE_INSTALL_DATAROOTDIR}/java/cameo)
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR})


add_custom_command(
  OUTPUT ${PROJECT_JAR}
24
25
  COMMAND mvn clean install
  WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../
26
27
  VERBATIM
  )
28

29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
add_custom_target(server
  ALL
  DEPENDS ${PROJECT_JAR}
  COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_JAR} ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}
  )

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/installed/${JAVA_INSTALL_DIR}/
  DESTINATION ${JAVA_INSTALL_DIR}
  )

install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/../cameo-server/scripts/cameo-server
  TYPE BIN
  )

#------------------------------------------------------------
# CPack
if(${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME})
  include(${CMAKE_CURRENT_SOURCE_DIR}/../CPackConfigCommon.in)
  include(${CMAKE_CURRENT_SOURCE_DIR}/CPackConfig.in)
  include(CPack)
endif()
#------------------------------------------------------------