blob: 83063188a1a2e65c8738b079c633ca49e61ef091 [file] [log] [blame]
Pascal Bachd5f87e12014-12-12 15:59:17 +01001#
2# Licensed to the Apache Software Foundation (ASF) under one
3# or more contributor license agreements. See the NOTICE file
4# distributed with this work for additional information
5# regarding copyright ownership. The ASF licenses this file
6# to you under the Apache License, Version 2.0 (the
7# "License"); you may not use this file except in compliance
8# with the License. You may obtain a copy of the License at
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
12# Unless required by applicable law or agreed to in writing,
13# software distributed under the License is distributed on an
14# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15# KIND, either express or implied. See the License for the
16# specific language governing permissions and limitations
17# under the License.
18#
19
20
21cmake_minimum_required(VERSION 2.8)
22
23# Find required packages
24find_package(Ant REQUIRED)
25
26if(IS_ABSOLUTE "${LIB_INSTALL_DIR}")
27 set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
28else()
29 set(JAVA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/java")
30endif()
31
32if(IS_ABSOLUTE "${DOC_INSTALL_DIR}")
33 set(JAVA_DOC_INSTALL_DIR "${DOC_INSTALL_DIR}/java")
34else()
35 set(JAVA_DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}/java")
36endif()
37
38add_custom_target(ant_build ALL
39 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} -Dbuild.dir=${CMAKE_CURRENT_BINARY_DIR} -Dworking.dir=${work_dir} -f build.xml
40 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
41 COMMENT "Building Java library using Ant"
42)
43
44# Hook the ant install task into CMake install
45install(CODE "execute_process(
46 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} install
47 -Dbuild.dir=${CMAKE_CURRENT_BINARY_DIR} -Dworking.dir=${work_dir}
48 -Dinstall.path=${JAVA_INSTALL_DIR} -Dinstall.javadoc.path=${JAVA_DOC_INSTALL_DIR} -f build.xml
49 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
50)")
51
52if(BUILD_TESTING)
53 #add_subdirectory(test)
54endif()