forked from includeos/demo-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
63 lines (57 loc) · 1.46 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
cmake_minimum_required(VERSION 3.0)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(EXAMPLES
256_color_vga
acorn
demo_service
http_client
IRCd
LiveUpdate
microLB
router
scoped_profiler
snake
starlight
STREAM
syslog
tcp
TCP_perf
TLS_server
transfer
UDP_perf
#TODO
#userspace_demo
vlan
websocket
)
if (PROTOBUF)
list(APPEND EXAMPLES protobuf)
endif()
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.13/conan.cmake"
"${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
if (CONAN_PROFILE)
set(CONANPROFILE PROFILE ${CONAN_PROFILE})
endif()
foreach(example ${EXAMPLES})
if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${example}/conanfile.txt)
set(OLD_DIR ${CMAKE_CURRENT_BINARY_DIR})
set(CMAKE_CURRENT_BINARY_DIR ${OLD_DIR}/${example})
file(MAKE_DIRECTORY ${OLD_DIR}/${example})
#clear any old libs from last pass.. this is a ugly hack
set(CONAN_LIBS "")
conan_cmake_run(
CONANFILE ${example}/conanfile.txt
${CONANPROFILE}
)
set(CMAKE_CURRENT_BINARY_DIR ${OLD_DIR})
endif()
#we cant add the subdir unless conan install is already run
#because the CMakeLists.txt needs coanbuildinfo.cmake which is needed to find os.cmake
add_subdirectory(${example} ${example})
endforeach()