forked from orocos-toolchain/rtt
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFindCorba.cmake
73 lines (63 loc) · 2.58 KB
/
FindCorba.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#
# Detect CORBA using user's CORBA_IMPLEMENTATION
#
if (ENABLE_CORBA)
SET(CORBA_FOUND)
IF( CORBA_IMPLEMENTATION STREQUAL "TAO")
# Look for TAO and ACE
if(${OROCOS_TARGET} MATCHES "win32")
set(XTRA_TAO_LIBS AnyTypeCode ValueType) #note: capital T
endif()
if(${OROCOS_TARGET} MATCHES "macosx|gnulinux|xenomai|lxrt")
set(XTRA_TAO_LIBS AnyTypeCode Valuetype) #note: small T
endif()
find_package(TAO REQUIRED IDL PortableServer CosNaming Messaging ${XTRA_TAO_LIBS})
SET(CORBA_FOUND ${TAO_FOUND})
IF(NOT TAO_FOUND)
MESSAGE(FATAL_ERROR "Cannot find TAO")
ELSE(NOT TAO_FOUND)
MESSAGE(STATUS "CORBA enabled: ${TAO_FOUND_COMPONENTS}")
# Copy flags:
SET(CORBA_INCLUDE_DIRS ${TAO_INCLUDE_DIRS})
SET(CORBA_CFLAGS ${TAO_CPP_FLAGS})
SET(CORBA_LIBRARIES ${TAO_LIBRARIES})
SET(CORBA_DEFINITIONS ${TAO_DEFINITIONS})
# Flag used in rtt-corba-config.h
SET(CORBA_IS_TAO 1)
if( TAO_Messaging_FOUND )
SET(CORBA_TAO_HAS_MESSAGING 1)
endif()
# Including a TAO header is sufficient to depend on this library.
set(CORBA_USER_LINK_LIBS ${TAO_CLIENT_LIBRARIES} )
# We noticed TAO depends on librt as well on Linux platforms
if(${OROCOS_TARGET} MATCHES "gnulinux|xenomai|lxrt")
set(CORBA_LIBRARIES ${CORBA_LIBRARIES} rt )
set(CORBA_USER_LINK_LIBS ${CORBA_USER_LINK_LIBS} rt )
endif()
ENDIF(NOT TAO_FOUND)
ELSEIF(CORBA_IMPLEMENTATION STREQUAL "OMNIORB")
find_package(OmniORB REQUIRED)
SET(CORBA_FOUND ${OMNIORB4_FOUND})
IF(NOT OMNIORB4_FOUND)
MESSAGE(FATAL_ERROR "cannot find OmniORB4")
ELSE(NOT OMNIORB4_FOUND)
MESSAGE(STATUS "CORBA enabled: OMNIORB")
# Copy flags:
SET(CORBA_INCLUDE_DIRS ${OMNIORB4_INCLUDE_DIR})
SET(CORBA_CFLAGS ${OMNIORB4_CPP_FLAGS})
SET(CORBA_LIBRARIES ${OMNIORB4_LIBRARIES})
SET(CORBA_DEFINITIONS ${OMNIORB4_DEFINITIONS})
# Flag used in rtt-corba-config.h
SET(CORBA_IS_OMNIORB 1)
list(APPEND RTT_CORBA_PKGCONFIG_DEPENDS omniORB4)
# Including an Omniorb header is sufficient to depend on this library.
set(CORBA_USER_LINK_LIBS ${OMNIORB4_CLIENT_LIBRARIES} )
ENDIF(NOT OMNIORB4_FOUND)
ELSE(CORBA_IMPLEMENTATION STREQUAL "TAO")
MESSAGE(FATAL_ERROR "Unknown CORBA implementation '${CORBA_IMPLEMENTATION}': must be TAO or OMNIORB.")
ENDIF(CORBA_IMPLEMENTATION STREQUAL "TAO")
# Bail if we were required to find all components and missed at least one
IF (CORBA_FIND_REQUIRED AND NOT CORBA_FOUND)
MESSAGE (FATAL_ERROR "Could not find CORBA")
ENDIF ()
endif (ENABLE_CORBA)