-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
60 lines (48 loc) · 2.04 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
cmake_minimum_required(VERSION 3.15)
project(dnssd-cpp VERSION 0.0.1)
option(DNSSD_NO_EXAMPLES "Disable examples" OFF)
set(CMAKE_CXX_STANDARD 11)
add_library(dnssd-cpp STATIC
include/dnssd/Browser.h
include/dnssd/bonjour/Bonjour.h
include/dnssd/bonjour/BonjourAdvertiser.h
include/dnssd/bonjour/BonjourBrowser.h
include/dnssd/bonjour/ScopedDnsServiceRef.h
include/dnssd/bonjour/Service.h
include/dnssd/bonjour/SharedConnection.h
include/dnssd/common/AdvertiserBase.h
include/dnssd/common/BrowserBase.h
include/dnssd/common/TxtRecord.h
include/dnssd/common/Util.h
src/ServiceDescription.cpp
src/bonjour/Bonjour.cpp
src/bonjour/BonjourAdvertiser.cpp
src/bonjour/BonjourBrowser.cpp
src/bonjour/BonjourTxtRecord.cpp
src/bonjour/ScopedDnsServiceRef.cpp
src/bonjour/Service.cpp
src/bonjour/SharedConnection.cpp
src/common/Result.cpp
src/common/Result.cpp
src/common/Log.cpp
)
target_include_directories(dnssd-cpp PUBLIC include)
if (WIN32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /NODEFAULTLIB:libcmt")
target_include_directories(dnssd-cpp PUBLIC "C:/Program Files/Bonjour SDK/Include")
# Link dnssd.lib depending on architecture
if (MSVC_CXX_ARCHITECTURE_ID MATCHES "64")
target_link_libraries(dnssd-cpp PUBLIC "C:/Program Files/Bonjour SDK/Lib/x64/dnssd.lib")
elseif (MSVC_CXX_ARCHITECTURE_ID MATCHES "86")
target_link_libraries(dnssd-cpp PUBLIC "C:/Program Files/Bonjour SDK/Lib/Win32/dnssd.lib")
else ()
message(FATAL_ERROR "Unknown MSVC architecture or non CXX language [${MSVC_CXX_ARCHITECTURE_ID}]")
endif ()
target_link_libraries(dnssd-cpp PUBLIC ws2_32)
endif ()
if (NOT DNSSD_NO_EXAMPLES)
add_executable(dnssd-advertiser examples/dnssd-advertiser.cpp)
target_link_libraries(dnssd-advertiser dnssd-cpp)
add_executable(dnssd-browser examples/dnssd-browser.cpp)
target_link_libraries(dnssd-browser dnssd-cpp)
endif ()