-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
86 lines (71 loc) · 2.41 KB
/
Copy pathCMakeLists.txt
File metadata and controls
86 lines (71 loc) · 2.41 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.12)
project(ACE_Examples
VERSION 1.0.0
DESCRIPTION "ACE (ADAPTIVE Communication Environment) Examples"
LANGUAGES CXX
)
# ---------------------------
# Set C++ standard
# ---------------------------
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ACE_ROOT $ENV{ACE_ROOT})
set(TAO_ROOT $ENV{TAO_ROOT})
# ---------------------------
# Locate ACE includes
# ---------------------------
find_path(ACE_INCLUDE_DIR ace/ACE.h
HINTS ${ACE_ROOT} /usr/include /usr/local/include
PATH_SUFFIXES ace
)
if(NOT ACE_INCLUDE_DIR)
message(FATAL_ERROR "Could not find ACE headers (ace/ACE.h). Set ACE_ROOT correctly.")
endif()
# ---------------------------
# Find all libraries under $ACE_ROOT/lib
# ---------------------------
file(GLOB ACE_LIB_FILES "${ACE_ROOT}/lib/*")
foreach(libfile IN LISTS ACE_LIB_FILES)
get_filename_component(libname ${libfile} NAME_WE)
# Skip if not a real library
if(NOT libname MATCHES "^(lib)?[A-Za-z0-9_]+$")
continue()
endif()
# Remove 'lib' prefix if present
string(REGEX REPLACE "^lib" "" target_name ${libname})
# Create target name like ACE::TAO_PortableServer
string(REPLACE "-" "_" target_name ${target_name})
set(target ACE::${target_name})
if(NOT TARGET ${target})
add_library(${target} UNKNOWN IMPORTED)
set_target_properties(${target} PROPERTIES
IMPORTED_LOCATION ${libfile}
INTERFACE_INCLUDE_DIRECTORIES ${ACE_INCLUDE_DIR}
)
message(STATUS "Registered ${target} -> ${libfile}")
endif()
endforeach()
# ---------------------------
# Find tao_idl
# ---------------------------
find_program(TAO_IDL_EXECUTABLE tao_idl
HINTS ${ACE_ROOT}/bin ${TAO_ROOT}/bin
)
if(NOT TAO_IDL_EXECUTABLE)
message(FATAL_ERROR "tao_idl not found. Please ensure ACE_ROOT/TAO_ROOT is set.")
endif()
# ---------------------------
# Add subdirectories for each example
# ---------------------------
add_subdirectory(hello_reactor)
add_subdirectory(basic_tcp_server_client)
add_subdirectory(basic_multicast)
add_subdirectory(basic_corba_call)
add_subdirectory(basic_corba_naming_service)
add_subdirectory(tao_multicast)
# ---------------------------
# Print build information
# ---------------------------
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")