Salome HOME
Remove useless dependency to py2cpp.
[tools/adao_interface.git] / CMakeLists.txt
1 # Copyright (C) 2019 EDF R&D
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 # Author: Anthony Geay, anthony.geay@edf.fr, EDF R&D
20
21 cmake_minimum_required(VERSION 2.6)
22 project(AdaoExchangeLayer)
23
24 ##
25
26 set(BUILD_SHARED_LIBS TRUE)
27 set(CONFIGURATION_ROOT_DIR $ENV{CONFIGURATION_ROOT_DIR} CACHE PATH "Path to the Salome CMake configuration files")
28 if(EXISTS ${CONFIGURATION_ROOT_DIR})
29   list(APPEND CMAKE_MODULE_PATH "${CONFIGURATION_ROOT_DIR}/cmake")
30   include(SalomeMacros)
31   include(SalomeSetupPlatform)
32 else(EXISTS ${CONFIGURATION_ROOT_DIR})
33   message(FATAL_ERROR "We absolutely need the Salome CMake configuration files, please define CONFIGURATION_ROOT_DIR !")
34 endif(EXISTS ${CONFIGURATION_ROOT_DIR})
35
36 ##
37
38 option(AEL_ENABLE_TESTS "Build tests (default ON)." ON)
39 if(AEL_ENABLE_TESTS)
40   if(EXISTS ${PY2CPP_ROOT_DIR})
41     set(PY2CPP_ROOT_DIR $ENV{PY2CPP_ROOT_DIR} CACHE PATH "Path to Py2cpp")
42     set(Py2cpp_DIR "${PY2CPP_ROOT_DIR}/lib/cmake/py2cpp")
43     find_package(Py2cpp REQUIRED)
44     find_package(SalomeCppUnit)
45   else(EXISTS ${PY2CPP_ROOT_DIR})
46     message(FATAL_ERROR "PY2CPP declared as enabled whereas not found !")
47   endif(EXISTS ${PY2CPP_ROOT_DIR})
48 endif(AEL_ENABLE_TESTS)
49
50 ##
51
52 find_package(SalomePythonInterp REQUIRED)
53 find_package(SalomePythonLibs REQUIRED)
54
55 ##
56
57 include_directories(
58   ${PYTHON_INCLUDE_DIRS}
59   ${CPPUNIT_INCLUDE_DIRS}
60   )
61 set(adaoexchange_SOURCES AdaoExchangeLayer.cxx AdaoModelKeyVal.cxx)
62 add_library(adaoexchange ${adaoexchange_SOURCES})
63 target_link_libraries(adaoexchange ${PYTHON_LIBRARIES})
64 install(FILES AdaoExchangeLayer.hxx PyObjectRAII.hxx AdaoExchangeLayerException.hxx AdaoModelKeyVal.hxx DESTINATION include)
65 install(TARGETS adaoexchange DESTINATION lib)
66
67 ##
68
69 if(AEL_ENABLE_TESTS)
70   add_executable(TestAdaoExchange TestAdaoExchange.cxx)
71   target_link_libraries(TestAdaoExchange adaoexchange py2cpp ${CPPUNIT_LIBRARIES})
72   install(TARGETS TestAdaoExchange DESTINATION bin)
73 endif(AEL_ENABLE_TESTS)