Salome HOME
bf3563dda2f5a35b5096250c4346ef29a4246482
[tools/configuration.git] / cmake / FindXDR.cmake
1 # Copyright (C) 2007-2019  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, or (at your option) any later version.
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 MESSAGE(STATUS "Check for XDR ...")
21
22 FIND_PATH(XDR_INCLUDE_DIRS rpc/xdr.h)
23 IF(XDR_INCLUDE_DIRS)
24    SET(XDR_DEFINITIONS "-DHAS_XDR")
25 ENDIF()
26
27 IF(WIN32)
28   FIND_LIBRARY(XDR_LIBRARIES xdr)                 # To get the .lib file from XDR
29   FIND_PATH(XDR_INCLUDE_DIRS2 stdint.h PATH_SUFFIXES src/msvc)  # To get the stdint.h from XDR (needed by types.h)
30   IF(XDR_INCLUDE_DIRS)
31     IF(XDR_INCLUDE_DIRS2)
32       LIST(APPEND XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}")
33     ELSE()
34       SET(XDR_INCLUDE_DIRS "${XDR_INCLUDE_DIRS2}")  # Make the detection fail
35     ENDIF()
36   ENDIF()
37 ENDIF(WIN32)
38
39 INCLUDE(FindPackageHandleStandardArgs)
40 FIND_PACKAGE_HANDLE_STANDARD_ARGS(XDR REQUIRED_VARS XDR_INCLUDE_DIRS)