# Copyright (C) 2013 CEA/DEN, EDF R&D, OPEN CASCADE # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version 2.1 of the License. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # CMAKE_MINIMUM_REQUIRED(VERSION 2.8.8 FATAL_ERROR) PROJECT(SimanIO C CXX) # Versioning # =========== # Project name, upper case STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC) SET(${PROJECT_NAME_UC}_MAJOR_VERSION 1) SET(${PROJECT_NAME_UC}_MINOR_VERSION 0) SET(${PROJECT_NAME_UC}_PATCH_VERSION 0) SET(${PROJECT_NAME_UC}_VERSION ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION}) # Our own set of macros: LIST(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules) INCLUDE(SimanIOMacros) # User options # ============ IF(WIN32 AND NOT CYGWIN) SET(INSTALL_CMAKE_CONFIG_DIR cmake) ELSE() SET(INSTALL_CMAKE_CONFIG_DIR share/cmake/simanio) ENDIF() SET(INSTALL_INCLUDE_DIR include) # Prerequisites detection: # ======================== FIND_PACKAGE(SimanIOWSO2 REQUIRED) # Configure # ========= CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/SimanIO_Version.hxx.in ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/src/SimanIO_Version.hxx DESTINATION include) ADD_SUBDIRECTORY(src) ADD_SUBDIRECTORY(scripts) # Export logic # ============ INCLUDE(CMakePackageConfigHelpers) # Add all targets to the build-tree export set EXPORT(TARGETS SimanIO FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Targets.cmake) # Create the configuration files: # - in the build tree: # Ensure the variables are always defined for the configure: SET(WSO2_ROOT_DIR "${WSO2_ROOT_DIR}") SET(CONF_INCLUDE_DIRS "${PROJECT_SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}/include") CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}" PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR) # - in the install tree: # Get the relative path of the include directory so # we can register it in the generated configuration files: SET(CONF_INCLUDE_DIRS "${CMAKE_INSTALL_PREFIX}/${INSTALL_INCLUDE_DIR}") CONFIGURE_PACKAGE_CONFIG_FILE(misc/${PROJECT_NAME}Config.cmake.in ${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake INSTALL_DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}" PATH_VARS CONF_INCLUDE_DIRS INSTALL_CMAKE_CONFIG_DIR CMAKE_INSTALL_PREFIX WSO2_ROOT_DIR) WRITE_BASIC_PACKAGE_VERSION_FILE(${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake VERSION ${${PROJECT_NAME_UC}_VERSION} COMPATIBILITY AnyNewerVersion) # Install the CMake configuration files: INSTALL(FILES "${PROJECT_BINARY_DIR}/to_install/${PROJECT_NAME}Config.cmake" "${PROJECT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake" DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}") # Install the export set for use with the install-tree INSTALL(EXPORT ${PROJECT_NAME}Targets DESTINATION "${INSTALL_CMAKE_CONFIG_DIR}")