blob: e9150786127979e8c3eb8820ab33d6a2e491267b [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
Pascal Bachd5f87e12014-12-12 15:59:17 +010023if(IS_ABSOLUTE "${LIB_INSTALL_DIR}")
24 set(JAVA_INSTALL_DIR "${LIB_INSTALL_DIR}/java")
25else()
26 set(JAVA_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIB_INSTALL_DIR}/java")
27endif()
28
29if(IS_ABSOLUTE "${DOC_INSTALL_DIR}")
30 set(JAVA_DOC_INSTALL_DIR "${DOC_INSTALL_DIR}/java")
31else()
32 set(JAVA_DOC_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}/java")
33endif()
34
35add_custom_target(ant_build ALL
36 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} -Dbuild.dir=${CMAKE_CURRENT_BINARY_DIR} -Dworking.dir=${work_dir} -f build.xml
37 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
38 COMMENT "Building Java library using Ant"
39)
40
41# Hook the ant install task into CMake install
42install(CODE "execute_process(
43 COMMAND ${Ant_EXECUTABLE} ${ANT_FLAGS} install
44 -Dbuild.dir=${CMAKE_CURRENT_BINARY_DIR} -Dworking.dir=${work_dir}
45 -Dinstall.path=${JAVA_INSTALL_DIR} -Dinstall.javadoc.path=${JAVA_DOC_INSTALL_DIR} -f build.xml
46 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
47)")
48
49if(BUILD_TESTING)
50 #add_subdirectory(test)
51endif()