Salome HOME
cfb8da2a93d81370052b3466e6a4df08fc8f3cf4
[tools/simanio.git] / CMakeLists.txt
1 #  Copyright (C) 2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 #  This library is free software; you can redistribute it and/or
4 #  modify it under the terms of the GNU Lesser General Public
5 #  License as published by the Free Software Foundation; either
6 #  version 2.1 of the License.
7 #
8 #  This library is distributed in the hope that it will be useful,
9 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
10 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 #  Lesser General Public License for more details.
12 #
13 #  You should have received a copy of the GNU Lesser General Public
14 #  License along with this library; if not, write to the Free Software
15 #  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 #
17 #  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 #
19
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
21 PROJECT(SimanIO C CXX)
22
23 # Versioning
24 # ===========
25 # Project name, upper case
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
27
28 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 0)
29 SET(${PROJECT_NAME_UC}_MINOR_VERSION 1)
30 SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
31 SET(${PROJECT_NAME_UC}_VERSION
32   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
33
34 # Our own set of macros:
35 LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
36 INCLUDE(SimanIOMacros)
37
38 # User options
39 # ============
40 IF(WIN32 AND NOT CYGWIN)
41   SET(INSTALL_CMAKE_CONFIG_DIR cmake)
42 ELSE()
43   SET(INSTALL_CMAKE_CONFIG_DIR share/cmake/simanio)
44 ENDIF()
45 SET(INSTALL_INCLUDE_DIR include)
46
47 # Prerequisites detection:
48 # ========================
49 FIND_PACKAGE(SimanIOWSO2 REQUIRED)
50
51 # Configure
52 # =========
53 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/SimanIO_Version.hxx.in ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx @ONLY)
54 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx DESTINATION include)
55
56 ADD_SUBDIRECTORY(src)
57 ADD_SUBDIRECTORY(scripts)
58
59 # Export logic
60 # ============
61 INCLUDE(CMakePackageConfigHelpers)
62
63 # Add all targets to the build-tree export set
64 EXPORT(TARGETS SimanIO FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
65
66 # Create the configuration files:
67 #   - in the build tree:
68
69 #      Ensure the variables are always defined for the configure:
70 SET(WSO2_ROOT_DIR "${WSO2_ROOT_DIR}")
71  
72 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
73 CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in 
74     ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
75     INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
76     PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
77
78 #   - in the install tree:
79 #       Get the relative path of the include directory so 
80 #       we can register it in the generated configuration files:
81 SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
82 CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in 
83     ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
84     INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
85     PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
86
87 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
88     VERSION ${${PROJECT_NAME_UC}_VERSION}
89     COMPATIBILITY AnyNewerVersion)
90   
91 # Install the CMake configuration files:
92 INSTALL(FILES
93   "${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake"
94   "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
95   DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")
96
97 # Install the export set for use with the install-tree
98 INSTALL(EXPORT ${PROJECT_NAME}Targets DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")