~zorba-coders/zorba/trunk

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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Copyright 2006-2010 The FLWOR Foundation.
# 
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# 
# http://www.apache.org/licenses/LICENSE-2.0
# 
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


# Calculate ZORBA_ROOT, which is the base dir of the Zorba installation.
# Zorba_DIR will be set to the directory containing ZorbaConfig.cmake,
# which is in a different place on Windows than Unix, so work from there.
IF (WIN32)
  # ZORBA_ROOT/cmake/ZorbaConfig.cmake
  SET (ZORBA_ROOT "\${Zorba_DIR}/..")
ELSE (WIN32)
  # ZORBA_ROOT/share/zorba-VERSION/cmake/ZorbaConfig.cmake
  SET (ZORBA_ROOT "\${Zorba_DIR}/../../..")
ENDIF (WIN32)

# Create ZorbaConfig.cmake file for projects that wish to build
# against the installed Zorba project.
SET(Zorba_INCLUDE_DIRS "${ZORBA_ROOT}/include")
SET(Zorba_LIBRARY_DIRS "${ZORBA_ROOT}/lib")
SET(Zorba_USE_FILE "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ZorbaUse.cmake")
SET(Zorba_CMAKE_MODULES_DIR "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}")
SET(Zorba_TESTDRIVER "${ZORBA_ROOT}/bin/testdriver")
SET(Zorba_EXE_PATH "${ZORBA_ROOT}/bin/zorba")
SET(Zorba_EXTERNALMODULECONFIG_FILE
  "${ZORBA_ROOT}/${ZORBA_CMAKE_DIR}/ExternalModuleConfig.cmake.in")   
SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_ROOT}/${ZORBA_MODULES_INSTALL_DIR}")

CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
  "${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)
INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/ZorbaConfig.cmake"
 DESTINATION ${ZORBA_CMAKE_DIR})

# Create ZorbaConfig.cmake file for projects that wish to build
# against this Zorba source installation.
SET(Zorba_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/include"
                       "${CMAKE_BINARY_DIR}/include"
)
SET(Zorba_LIBRARY_DIRS "${CMAKE_BINARY_DIR}/src")
SET(Zorba_CMAKE_MODULES_DIR "${CMAKE_SOURCE_DIR}/cmake_modules")
SET(Zorba_USE_FILE     "${CMAKE_CURRENT_SOURCE_DIR}/ZorbaUse.cmake")
GET_TARGET_PROPERTY(Zorba_TESTDRIVER testdriver LOCATION)

IF (WIN32)
  IF (MSVC_IDE)
    STRING (REPLACE "/${CMAKE_CFG_INTDIR}" "" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})
  ENDIF (MSVC_IDE)
  STRING (REPLACE ".exe" ".bat" Zorba_TESTDRIVER ${Zorba_TESTDRIVER})
ENDIF (WIN32)

SET(Zorba_EXE_PATH     "${ZORBA_EXE}")
SET(Zorba_EXTERNALMODULECONFIG_FILE
  "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in")
# Note: We also set these two into the parent's scope, so that it is
# available for the rest of the build.
SET(Zorba_EXTERNALMODULECONFIG_FILE
  "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"
  PARENT_SCOPE)
SET(Zorba_EXE "${ZORBA_EXE}" PARENT_SCOPE)

# Note: This value doesn't really make much sense, but neither does any
# other value
SET(Zorba_MODULES_INSTALL_DIR "${ZORBA_MODULES_INSTALL_DIR}")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfig.cmake.in"
  "${CMAKE_BINARY_DIR}/ZorbaConfig.cmake" @ONLY)


# Create ZorbaConfigVersion.cmake file for automatic version checking.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/ZorbaConfigVersion.cmake.in"
  "${CMAKE_BINARY_DIR}/ZorbaConfigVersion.cmake" @ONLY)
INSTALL(FILES
  "${CMAKE_BINARY_DIR}/ZorbaConfigVersion.cmake"
  DESTINATION ${ZORBA_CMAKE_DIR})


# Install ZorbaUse.cmake file for sharing build settings and macros
# with dependent projects.
INSTALL(FILES
  "${CMAKE_CURRENT_SOURCE_DIR}/ZorbaUse.cmake"
  DESTINATION ${ZORBA_CMAKE_DIR})


# Install ExternalModuleConfig.cmake.in as-is (will be configured by
# the modules themselves)
INSTALL(FILES
  "${CMAKE_CURRENT_SOURCE_DIR}/ExternalModuleConfig.cmake.in"
  DESTINATION ${ZORBA_CMAKE_DIR})


ADD_SUBDIRECTORY(fedora)
ADD_SUBDIRECTORY(debian)