1- cmake_minimum_required (VERSION 3.6 )
1+ cmake_minimum_required (VERSION 3.11 )
22project (sleepy-discord)
33
44option (BUILD_EXAMPLES "Build examples of Sleepy Discord and all dependencies" OFF )
@@ -51,7 +51,7 @@ if(AUTO_DOWNLOAD_LIBRARY)
5151 #to do find librarys before downloading them
5252
5353 include (ExternalProject )
54- include (buildtools/cmake/DownloadProject.cmake )
54+ include (FetchContent )
5555
5656endif ()
5757
@@ -63,13 +63,13 @@ if(USE_CPR)
6363 else ()
6464 if (AUTO_DOWNLOAD_LIBRARY)
6565 #to do install libssl-dev
66- download_project (
67- PROJ cpr
68- GIT_REPOSITORY https://github.com/whoshuu/cpr.git
69- GIT_TAG 41fbaca
70- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/cpr
71- UPDATE_DISCONNECTED 1
66+ FetchContent_Declare (
67+ cpr
68+ GIT_REPOSITORY https://github.com/whoshuu/cpr.git
69+ GIT_TAG 41fbaca
70+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/cpr
7271 )
72+ FetchContent_MakeAvailable (cpr)
7373 endif ()
7474
7575 #the cmake test has issues on visual studio so disable them
@@ -108,13 +108,13 @@ if(USE_ASIO)
108108 find_package (asio CONFIG REQUIRED )
109109 else ()
110110 if (AUTO_DOWNLOAD_LIBRARY)
111- download_project (
112- PROJ asio
111+ FetchContent_Declare (
112+ asio
113113 GIT_REPOSITORY https://github.com/chriskohlhoff/asio.git
114- GIT_TAG master
115- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/asio
116- UPDATE_DISCONNECTED 1
114+ GIT_TAG master
115+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/asio
117116 )
117+ FetchContent_MakeAvailable (asio)
118118 endif ()
119119
120120 if (NOT DEFINED asio_SOURCE_DIR )
@@ -129,13 +129,13 @@ if(USE_LIBOPUS)
129129 else ()
130130 if (AUTO_DOWNLOAD_LIBRARY)
131131 #needs libtool
132- download_project (
133- PROJ opus
132+ FetchContent_Declare (
133+ opus
134134 GIT_REPOSITORY https://gitlab.xiph.org/xiph/opus.git
135- GIT_TAG 7628d844
136- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/opus
137- UPDATE_DISCONNECTED 1
135+ GIT_TAG 7628d844
136+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/opus
138137 )
138+ FetchContent_MakeAvailable (opus)
139139 endif ()
140140
141141 add_subdirectory (deps/opus )
@@ -149,13 +149,13 @@ endif()
149149if (USE_LIBSODIUM)
150150 if (NOT WIN32 AND NOT SLEEPY_VCPKG)
151151 if (AUTO_DOWNLOAD_LIBRARY)
152- download_project (
153- PROJ libsodium
152+ FetchContent_Declare (
153+ libsodium
154154 GIT_REPOSITORY https://github.com/jedisct1/libsodium.git
155155 GIT_TAG stable
156- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/libsodium
157- UPDATE_DISCONNECTED 1
156+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/libsodium
158157 )
158+ FetchContent_MakeAvailable (libsodium)
159159 ExternalProject_Add (libsodium-make
160160 SOURCE_DIR "${libsodium_SOURCE_DIR} "
161161 BINARY_DIR "${libsodium_BINARY_DIR} "
@@ -173,13 +173,13 @@ endif()
173173
174174if (USE_ZLIB_NG)
175175 if (AUTO_DOWNLOAD_LIBRARY)
176- download_project (
177- PROJ zlib-ng
176+ FetchContent_Declare (
177+ zlib-ng
178178 GIT_REPOSITORY https://github.com/zlib-ng/zlib-ng.git
179179 GIT_TAG develop
180- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/zlib-ng
181- UPDATE_DISCONNECTED 1
180+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/zlib-ng
182181 )
182+ FetchContent_MakeAvailable (zlib-ng)
183183 endif ()
184184
185185 add_subdirectory (deps/zlib-ng )
@@ -195,13 +195,13 @@ if (USE_BEAST)
195195 find_package (Boost REQUIRED COMPONENTS beast )
196196 else ()
197197 if (AUTO_DOWNLOAD_LIBRARY)
198- download_project (
199- PROJ beast
198+ FetchContent_Declare (
199+ beast
200200 GIT_REPOSITORY https://github.com/boostorg/beast.git
201201 GIT_TAG master
202- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/beast
203- UPDATE_DISCONNECTED 1
202+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/beast
204203 )
204+ FetchContent_MakeAvailable (beast)
205205 endif ()
206206 endif ()
207207
@@ -214,13 +214,13 @@ if (USE_IXWEBSOCKET)
214214 find_library (IXWEBSOCKET_LIBRARY ixwebsocket )
215215 else ()
216216 if (AUTO_DOWNLOAD_LIBRARY)
217- download_project (
217+ FetchContent_Declare (
218218 PROJ IXWebSocket
219219 GIT_REPOSITORY https://github.com/machinezone/IXWebSocket.git
220220 GIT_TAG master
221- SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/ixwebsocket
222- UPDATE_DISCONNECTED 1
221+ SOURCE_DIR ${PROJECT_SOURCE_DIR} /deps/ixwebsocket
223222 )
223+ FetchContent_MakeAvailable (IXWebSocket)
224224 endif ()
225225
226226 add_subdirectory (deps/ixwebsocket )
0 commit comments