@@ -19,25 +19,21 @@ endfunction()
19
19
20
20
# Run Conan 1 for dependency management
21
21
macro (_run_conan1 )
22
- set (options
23
- DEPRECATED_CALL # For backward compability
22
+ set (options DEPRECATED_CALL # For backward compability
24
23
)
25
- set (one_value_args
26
- DEPRECATED_PROFILE # For backward compability
24
+ set (one_value_args DEPRECATED_PROFILE # For backward compability
27
25
)
28
- set (multi_value_args
29
- HOST_PROFILE
30
- BUILD_PROFILE
31
- INSTALL_ARGS
32
- DEPRECATED_OPTIONS # For backward compability
26
+ set (multi_value_args HOST_PROFILE BUILD_PROFILE INSTALL_ARGS DEPRECATED_OPTIONS # For backward compability
33
27
)
34
28
cmake_parse_arguments (_args "${options} " "${one_value_args} " "${multi_value_args} " ${ARGN} )
35
29
36
30
conan_get_version (_conan_current_version )
37
31
if (_conan_current_version VERSION_GREATER_EQUAL "2.0.0" )
38
- message (FATAL_ERROR
39
- "ENABLE_CONAN in `project_options(...)` only supports conan 1.\n "
40
- " If you're using conan 2, disable ENABLE_CONAN and use `run_conan(...)` before `project(...)`." )
32
+ message (
33
+ FATAL_ERROR
34
+ "ENABLE_CONAN in `project_options(...)` only supports conan 1.\n "
35
+ " If you're using conan 2, disable ENABLE_CONAN and use `run_conan(...)` before `project(...)`."
36
+ )
41
37
endif ()
42
38
43
39
# Download automatically, you can also just copy the conan.cmake file
@@ -67,9 +63,7 @@ macro(_run_conan1)
67
63
INDEX
68
64
0
69
65
)
70
- conan_add_remote (
71
- NAME bincrafters URL https://bincrafters.jfrog.io/artifactory/api/conan/public-conan
72
- )
66
+ conan_add_remote (NAME bincrafters URL https://bincrafters.jfrog.io/artifactory/api/conan/public-conan )
73
67
74
68
if (CONAN_EXPORTED )
75
69
# standard conan installation, in which deps will be defined in conanfile. It is not necessary to call conan again, as it is already running.
@@ -100,8 +94,9 @@ macro(_run_conan1)
100
94
endif ()
101
95
102
96
set (_should_detect FALSE )
103
- if (((NOT _args_DEPRECATED_CALL ) AND ((NOT _args_HOST_PROFILE ) OR ("auto-cmake" IN_LIST _args_HOST_PROFILE )))
104
- OR ((_args_DEPRECATED_CALL ) AND (NOT _args_DEPRECATED_PROFILE )))
97
+ if (((NOT _args_DEPRECATED_CALL ) AND ((NOT _args_HOST_PROFILE ) OR ("auto-cmake" IN_LIST _args_HOST_PROFILE )
98
+ )) OR ((_args_DEPRECATED_CALL ) AND (NOT _args_DEPRECATED_PROFILE ))
99
+ )
105
100
set (_should_detect TRUE )
106
101
list (REMOVE_ITEM _args_HOST_PROFILE "auto-cmake" )
107
102
endif ()
@@ -184,34 +179,31 @@ endmacro()
184
179
macro (_run_conan2 )
185
180
set (options )
186
181
set (one_value_args )
187
- set (multi_value_args
188
- HOST_PROFILE
189
- BUILD_PROFILE
190
- INSTALL_ARGS
191
- )
182
+ set (multi_value_args HOST_PROFILE BUILD_PROFILE INSTALL_ARGS )
192
183
cmake_parse_arguments (_args "${options} " "${one_value_args} " "${multi_value_args} " ${ARGN} )
193
184
194
185
if (CMAKE_VERSION VERSION_LESS "3.24.0" )
195
- message (FATAL_ERROR
196
- "`run_conan(...)` with conan 2 only supports cmake 3.24+, please update your cmake. \n "
197
- " Or you can downgrade your conan to use conan 1." )
186
+ message (FATAL_ERROR "`run_conan(...)` with conan 2 only supports cmake 3.24+, please update your cmake. \n "
187
+ " Or you can downgrade your conan to use conan 1. "
188
+ )
198
189
endif ()
199
190
200
191
conan_get_version (_conan_current_version )
201
192
if (_conan_current_version VERSION_LESS "2.0.5" )
202
- message (FATAL_ERROR
203
- "`run_conan(...)` with conan 2 only supports conan 2.0.5+, please update your conan.\n "
204
- " Or You can downgrade your conan to use conan 1." )
193
+ message (
194
+ FATAL_ERROR "`run_conan(...)` with conan 2 only supports conan 2.0.5+, please update your conan.\n "
195
+ " Or You can downgrade your conan to use conan 1."
196
+ )
205
197
endif ()
206
198
207
199
# Download automatically, you can also just copy the conan.cmake file
208
200
if (NOT EXISTS "${CMAKE_BINARY_DIR} /conan_provider.cmake" )
209
201
message (STATUS "Downloading conan_provider.cmake from https://github.com/conan-io/cmake-conan" )
210
202
file (
211
- DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/f6464d1e13ef7a47c569f5061f9607ea63339d39/conan_provider.cmake"
203
+ DOWNLOAD
204
+ "https://raw.githubusercontent.com/conan-io/cmake-conan/f6464d1e13ef7a47c569f5061f9607ea63339d39/conan_provider.cmake"
212
205
"${CMAKE_BINARY_DIR} /conan_provider.cmake"
213
206
EXPECTED_HASH SHA256=0a5eb4afbdd94faf06dcbf82d3244331605ef2176de32c09ea9376e768cbb0fc
214
-
215
207
# TLS_VERIFY ON # fails on some systems
216
208
)
217
209
endif ()
@@ -230,14 +222,24 @@ macro(_run_conan2)
230
222
231
223
set (CONAN_HOST_PROFILE "${_args_HOST_PROFILE} " CACHE STRING "Conan host profile" FORCE )
232
224
set (CONAN_BUILD_PROFILE "${_args_BUILD_PROFILE} " CACHE STRING "Conan build profile" FORCE )
233
- set (CONAN_INSTALL_ARGS "${_args_INSTALL_ARGS} " CACHE STRING "Command line arguments for conan install" FORCE )
225
+ set (CONAN_INSTALL_ARGS "${_args_INSTALL_ARGS} " CACHE STRING "Command line arguments for conan install"
226
+ FORCE
227
+ )
234
228
235
229
# A workaround from https://github.com/conan-io/cmake-conan/issues/595
236
230
list (APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_BINARY_DIR} /conan_provider.cmake" )
237
231
238
232
# Add this to invoke conan even when there's no find_package in CMakeLists.txt.
239
233
# This helps users get the third-party package names, which is used in later find_package.
240
- cmake_language (DEFER DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR} " CALL find_package Git QUIET )
234
+ cmake_language (
235
+ DEFER
236
+ DIRECTORY
237
+ "${CMAKE_CURRENT_SOURCE_DIR} "
238
+ CALL
239
+ find_package
240
+ Git
241
+ QUIET
242
+ )
241
243
endmacro ()
242
244
243
245
#[[.rst:
@@ -298,4 +300,4 @@ macro(run_conan)
298
300
else ()
299
301
_run_conan2 (${ARGN} )
300
302
endif ()
301
- endmacro ()
303
+ endmacro ()
0 commit comments