-
Notifications
You must be signed in to change notification settings - Fork 48
/
CMakeLists.txt
121 lines (111 loc) · 3.44 KB
/
CMakeLists.txt
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# Copyright (c) 1996-2024, OPC Foundation. All rights reserved.
#
# The source code in this file is covered under a dual-license scenario:
# - RCL: for OPC Foundation members in good-standing
# - GPL V2: everybody else
#
# RCL license terms accompanied with this source code. See http://opcfoundation.org/License/RCL/1.00/
#
# GNU General Public License as published by the Free Software Foundation;
# version 2 of the License are accompanied with this source code. See http://opcfoundation.org/License/GPLv2
#
# This source code 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.
#
cmake_minimum_required(VERSION 2.8.11)
project(ua-lds)
include(CMakeToolsHelpers OPTIONAL)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(_PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR} CACHE INTERNAL "Root" FORCE)
enable_testing()
#
# output paths
#
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
add_subdirectory(stack)
set_target_properties(uastack PROPERTIES FOLDER "stack")
if(WIN32)
if(NOT no_lds_me)
add_subdirectory(mdns)
set_target_properties(dnssd PROPERTIES FOLDER "mdns")
set_target_properties(dnssd-static PROPERTIES FOLDER "mdns")
endif()
endif()
set(_ualds_src
findservers.c
getendpoints.c
main.c
registerserver.c
registerserver2.c
settings.c
strlcat.c
strlcpy.c
ualds.c
utils.c
)
if(WIN32)
set(_ualds_src ${_ualds_src}
win32/certstore.c
win32/daemon.c
win32/getopt.c
win32/log.c
win32/platform.c
win32/service.c
win32/winmain.c
win32/version.rc
)
else()
include(FindPkgConfig)
if(NOT no_lds_me)
pkg_check_modules(LIBAVAHI avahi-compat-libdns_sd)
if(NOT LIBAVAHI_FOUND)
set(no_lds_me 1)
message(WARNING "no mdns/dnssd - install libavahi-compat-libdnssd-dev!")
endif()
endif()
set(_ualds_src ${_ualds_src}
linux/daemon.c
linux/log.c
linux/platform.c
)
endif()
if(NOT no_lds_me)
set(_ualds_src ${_ualds_src}
findserversonnetwork.c
zeroconf.c
)
endif()
add_executable(ualds ${_ualds_src})
set_target_properties(ualds PROPERTIES OUTPUT_NAME "opcualds")
target_link_libraries(ualds PUBLIC uastack)
target_compile_definitions(ualds
PUBLIC HAVE_OPCUA_STACK
PUBLIC HAVE_OPENSSL
)
if(WIN32)
target_include_directories(ualds PUBLIC win32)
target_compile_definitions(ualds
PUBLIC _WINDOWS
PUBLIC _CRT_NONSTDC_NO_WARNINGS
PUBLIC HAVE_SERVICE_REGISTER
PUBLIC HAVE_SERVICE_UNREGISTER
PUBLIC HAVE_SERVICE_START
PUBLIC HAVE_SERVICE_STOP
PUBLIC HAVE_SERVICE_STATUS
)
if(NOT no_lds_me)
target_compile_definitions(ualds PUBLIC HAVE_HDS)
target_link_libraries(ualds PUBLIC dnssd)
endif()
else()
target_include_directories(ualds PUBLIC linux)
install (TARGETS ualds RUNTIME DESTINATION bin)
if(NOT no_lds_me)
target_compile_definitions(ualds PUBLIC HAVE_HDS)
target_include_directories(ualds PUBLIC ${LIBAVAHI_INCLUDEDIR})
target_link_libraries(ualds PUBLIC ${LIBAVAHI_LIBRARIES})
endif()
endif()