1 # Copyright (C) 2013-2014 CEA/DEN, EDF R&D, OPEN CASCADE
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, or (at your option) any later version.
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.
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
17 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR)
21 PROJECT(SimanIO C CXX)
25 # Project name, upper case
26 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
28 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 1)
29 SET(${PROJECT_NAME_UC}_MINOR_VERSION 0)
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})
34 # Our own set of macros:
35 LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules)
36 INCLUDE(SimanIOMacros)
38 # Win32 specific definitions to avoid problems with std collection and iterators
41 ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) # To disable windows warnings for strcpy, fopen, ...
42 ADD_DEFINITIONS(-D_SCL_SECURE_NO_WARNINGS) # To disable windows warnings generated by checked iterators(e.g. std::copy, std::transform, ...)
43 # Disable iterator debugging on WINDOWS to avoid runtime error during checking iterators
45 # If defined as 1, unsafe iterator use causes a runtime error.
46 # If defined as 0, checked iterators are disabled.
47 # The default value for _SECURE_SCL is 1
49 # If defined as 1, an out of range iterator use causes an exception at runtime.
50 # If defined as 0, the program is terminated by calling invalid_parameter.
51 # The default value for _SECURE_SCL_THROWS is 0
53 ADD_DEFINITIONS(-D_SECURE_SCL=0 -D_SECURE_SCL_THROWS=0)
55 # The symbol _HAS_ITERATOR_DEBUGGING can be used to turn off the iterator debugging feature in a debug build
56 # If defined as 1, iterator debugging is enabled.
57 # If defined as 0, iterator debugging is disabled.
58 # The default value for _HAS_ITERATOR_DEBUGGING is 1
60 IF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
61 ADD_DEFINITIONS(-D_HAS_ITERATOR_DEBUGGING=0)
62 ENDIF(NOT CMAKE_BUILD_TYPE STREQUAL "RELEASE" AND NOT CMAKE_BUILD_TYPE STREQUAL "Release")
68 IF(WIN32 AND NOT CYGWIN)
69 SET(INSTALL_CMAKE_CONFIG_DIR cmake)
71 SET(INSTALL_CMAKE_CONFIG_DIR share/cmake/simanio)
73 SET(INSTALL_INCLUDE_DIR include)
75 # Prerequisites detection:
76 # ========================
77 FIND_PACKAGE(SimanIOWSO2 REQUIRED)
81 CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/SimanIO_Version.hxx.in ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx @ONLY)
82 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx DESTINATION include)
85 ADD_SUBDIRECTORY(scripts)
89 INCLUDE(CMakePackageConfigHelpers)
91 # Add all targets to the build-tree export set
92 EXPORT(TARGETS SimanIO FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake)
94 # Create the configuration files:
95 # - in the build tree:
97 # Ensure the variables are always defined for the configure:
98 SET(WSO2_ROOT_DIR "${WSO2_ROOT_DIR}")
100 SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include")
101 CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in
102 ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
103 INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
104 PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
106 # - in the install tree:
107 # Get the relative path of the include directory so
108 # we can register it in the generated configuration files:
109 SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}")
110 CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in
111 ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake
112 INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}"
113 PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR)
115 WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
116 VERSION ${${PROJECT_NAME_UC}_VERSION}
117 COMPATIBILITY AnyNewerVersion)
119 # Install the CMake configuration files:
121 "${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake"
122 "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
123 DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")
125 # Install the export set for use with the install-tree
126 INSTALL(EXPORT ${PROJECT_NAME}Targets DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")