Skip to content

Commit 2483476

Browse files
committed
fix: fix linting, formatting, and typo issues
1 parent 292f11f commit 2483476

30 files changed

+232
-282
lines changed

.cmake-format.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
format:
2-
line_width: 100
2+
line_width: 110
33
tab_size: 2
44
max_pargs_hwrap: 5
55
max_subgroups_hwrap: 3

cspell.config.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ words:
2323
- ccache
2424
- ccmake
2525
- choco
26-
- servor
2726
- cmake
2827
- CMAKE
2928
- cmakelint
@@ -63,6 +62,7 @@ words:
6362
- fstack
6463
- ftime
6564
- gcovr
65+
- genex
6666
- gnueabi
6767
- gnueabihf
6868
- Graphviz
@@ -116,6 +116,7 @@ words:
116116
- rpath
117117
- rtti
118118
- sccache
119+
- servor
119120
- setx
120121
- shlib
121122
- suppr
@@ -128,6 +129,7 @@ words:
128129
- undoc
129130
- vcpkg
130131
- vcvarsall
132+
- venv
131133
- visualc
132134
- visualcpp
133135
- VSCMD

docs/CMakeLists.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ configure_file(conf.py.in conf.py @ONLY)
6565
set(doc_formats "")
6666
if(SPHINX_HTML)
6767
list(APPEND doc_formats html)
68-
set(html_extra_commands COMMAND ${CMAKE_COMMAND} -E copy_directory
69-
${CMAKE_CURRENT_LIST_DIR}/root/ ${CMAKE_CURRENT_BINARY_DIR}
68+
set(html_extra_commands COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_LIST_DIR}/root/
69+
${CMAKE_CURRENT_BINARY_DIR}
7070
)
7171
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/js/versions.js
7272
"var ar_versions = [{\"version\": \"build\", \"folder\": \"html\", \"has_pdf\": false}]"
@@ -104,8 +104,8 @@ foreach(format ${doc_formats})
104104
add_custom_command(
105105
OUTPUT ${doc_format_output}
106106
COMMAND
107-
${SPHINX_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees -b
108-
${format} ${sphinx_flags} ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${format} >
107+
${SPHINX_EXECUTABLE} -c ${CMAKE_CURRENT_BINARY_DIR} -d ${CMAKE_CURRENT_BINARY_DIR}/doctrees -b ${format}
108+
${sphinx_flags} ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_CURRENT_BINARY_DIR}/${format} >
109109
${CMAKE_CURRENT_BINARY_DIR}/${doc_format_log} # log stdout, pass stderr
110110
${${format}_extra_commands}
111111
DEPENDS ${doc_format_last}
@@ -120,15 +120,11 @@ endforeach()
120120
add_custom_target(documentation ALL DEPENDS ${doc_format_outputs})
121121

122122
if(SPHINX_INFO)
123-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/texinfo/cmake.info DESTINATION ${CMAKE_INFO_DIR}
124-
${COMPONENT}
125-
)
123+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/texinfo/cmake.info DESTINATION ${CMAKE_INFO_DIR} ${COMPONENT})
126124
endif()
127125

128126
if(SPHINX_MAN)
129-
file(GLOB man_rst RELATIVE ${CMAKE_SOURCE_DIR}/Help/manual
130-
${CMAKE_SOURCE_DIR}/Help/manual/*.[1-9].rst
131-
)
127+
file(GLOB man_rst RELATIVE ${CMAKE_SOURCE_DIR}/Help/manual ${CMAKE_SOURCE_DIR}/Help/manual/*.[1-9].rst)
132128
foreach(m ${man_rst})
133129
if("x${m}" MATCHES "^x(.+)\\.([1-9])\\.rst$")
134130
set(name "${CMAKE_MATCH_1}")
@@ -142,8 +138,8 @@ if(SPHINX_MAN)
142138
endif()
143139
endif()
144140
if(NOT skip)
145-
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec}
146-
DESTINATION ${CMAKE_MAN_DIR}/man${sec} ${COMPONENT}
141+
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/${name}.${sec} DESTINATION ${CMAKE_MAN_DIR}/man${sec}
142+
${COMPONENT}
147143
)
148144
endif()
149145
unset(skip)

docs/cmake/FindSphinx.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ function(
5151
)
5252

5353
add_custom_target(
54-
${target_name} ALL COMMAND ${SPHINX_EXECUTABLE} -b ${builder} -c ${conf} ${source}
55-
${destination} COMMENT "Generating sphinx documentation: ${builder}"
54+
${target_name} ALL COMMAND ${SPHINX_EXECUTABLE} -b ${builder} -c ${conf} ${source} ${destination}
55+
COMMENT "Generating sphinx documentation: ${builder}"
5656
)
5757

5858
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${destination})

src/Clang.cmake

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ set(ProjectOptions_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}")
44

55
# detect clang
66
function(is_clang value)
7-
if(clang
8-
OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
9-
OR ("${DETECTED_CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${DETECTED_CMAKE_C_COMPILER_ID}"
10-
STREQUAL "Clang")
7+
if(clang OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${CMAKE_C_COMPILER_ID}" STREQUAL "Clang")
8+
OR ("${DETECTED_CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" AND "${DETECTED_CMAKE_C_COMPILER_ID}" STREQUAL
9+
"Clang")
1110
)
1211
set(${value} ON PARENT_SCOPE)
1312
return()
@@ -24,9 +23,7 @@ function(is_clang value)
2423
include("${ProjectOptions_SRC_DIR}/DetectCompiler.cmake")
2524
detect_compiler()
2625

27-
if((DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND DETECTED_CMAKE_C_COMPILER_ID STREQUAL
28-
"Clang")
29-
)
26+
if((DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND DETECTED_CMAKE_C_COMPILER_ID STREQUAL "Clang"))
3027
set(${value} ON PARENT_SCOPE)
3128
return()
3229
endif()

src/Common.cmake

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@ macro(common_project_options ENABLE_COMPILE_COMMANDS_SYMLINK)
2222
message(STATUS "Setting build type to 'RelWithDebInfo' as none was specified.")
2323
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
2424
# Set the possible values of build type for cmake-gui, ccmake
25-
set_property(
26-
CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo"
27-
)
25+
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
2826
endif()
2927

3028
get_property(BUILDING_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@@ -35,8 +33,8 @@ macro(common_project_options ENABLE_COMPILE_COMMANDS_SYMLINK)
3533
# list to only the configuration types you use, but only if one
3634
# is not forced-set on the command line for VS
3735
message(TRACE "Setting up multi-config build types")
38-
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo MinSizeRel
39-
CACHE STRING "Enabled build types" FORCE
36+
set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo MinSizeRel CACHE STRING
37+
"Enabled build types" FORCE
4038
)
4139
else()
4240
message(TRACE "User chose a specific build type, so we are using that")
@@ -61,9 +59,7 @@ macro(common_project_options ENABLE_COMPILE_COMMANDS_SYMLINK)
6159
# Make a symbol link of compile_commands.json on the source dir to help clang based tools find it
6260
if(WIN32)
6361
# Detect whether cmake is run as administrator (only administrator can read the LOCAL SERVICE account reg key)
64-
execute_process(
65-
COMMAND reg query "HKU\\S-1-5-19" ERROR_VARIABLE IS_NONADMINISTRATOR OUTPUT_QUIET
66-
)
62+
execute_process(COMMAND reg query "HKU\\S-1-5-19" ERROR_VARIABLE IS_NONADMINISTRATOR OUTPUT_QUIET)
6763
else()
6864
set(IS_NONADMINISTRATOR "")
6965
endif()
@@ -77,17 +73,14 @@ macro(common_project_options ENABLE_COMPILE_COMMANDS_SYMLINK)
7773
DEPENDS ${CMAKE_BINARY_DIR}/compile_commands.json
7874
VERBATIM
7975
)
80-
add_custom_target(
81-
_copy_compile_commands DEPENDS ${CMAKE_SOURCE_DIR}/compile_commands.json VERBATIM
82-
)
76+
add_custom_target(_copy_compile_commands DEPENDS ${CMAKE_SOURCE_DIR}/compile_commands.json VERBATIM)
8377
message(
8478
STATUS
8579
"compile_commands.json was not symlinked to the root. Run `cmake --build <build_dir> -t _copy_compile_commands` if needed."
8680
)
8781
else()
88-
file(CREATE_LINK ${CMAKE_BINARY_DIR}/compile_commands.json
89-
${CMAKE_SOURCE_DIR}/compile_commands.json SYMBOLIC
90-
RESULT _compile_commands_symlink_result
82+
file(CREATE_LINK ${CMAKE_BINARY_DIR}/compile_commands.json ${CMAKE_SOURCE_DIR}/compile_commands.json
83+
SYMBOLIC RESULT _compile_commands_symlink_result
9184
)
9285
if(_compile_commands_symlink_result EQUAL 0)
9386
message(TRACE "compile_commands.json was symlinked to the root.")

src/Conan.cmake

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,21 @@ endfunction()
1919

2020
# Run Conan 1 for dependency management
2121
macro(_run_conan1)
22-
set(options
23-
DEPRECATED_CALL # For backward compability
22+
set(options DEPRECATED_CALL # For backward compability
2423
)
25-
set(one_value_args
26-
DEPRECATED_PROFILE # For backward compability
24+
set(one_value_args DEPRECATED_PROFILE # For backward compability
2725
)
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
3327
)
3428
cmake_parse_arguments(_args "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
3529

3630
conan_get_version(_conan_current_version)
3731
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+
)
4137
endif()
4238

4339
# Download automatically, you can also just copy the conan.cmake file
@@ -67,9 +63,7 @@ macro(_run_conan1)
6763
INDEX
6864
0
6965
)
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)
7367

7468
if(CONAN_EXPORTED)
7569
# 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)
10094
endif()
10195

10296
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+
)
105100
set(_should_detect TRUE)
106101
list(REMOVE_ITEM _args_HOST_PROFILE "auto-cmake")
107102
endif()
@@ -184,34 +179,31 @@ endmacro()
184179
macro(_run_conan2)
185180
set(options)
186181
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)
192183
cmake_parse_arguments(_args "${options}" "${one_value_args}" "${multi_value_args}" ${ARGN})
193184

194185
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+
)
198189
endif()
199190

200191
conan_get_version(_conan_current_version)
201192
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+
)
205197
endif()
206198

207199
# Download automatically, you can also just copy the conan.cmake file
208200
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan_provider.cmake")
209201
message(STATUS "Downloading conan_provider.cmake from https://github.com/conan-io/cmake-conan")
210202
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"
212205
"${CMAKE_BINARY_DIR}/conan_provider.cmake"
213206
EXPECTED_HASH SHA256=0a5eb4afbdd94faf06dcbf82d3244331605ef2176de32c09ea9376e768cbb0fc
214-
215207
# TLS_VERIFY ON # fails on some systems
216208
)
217209
endif()
@@ -230,14 +222,24 @@ macro(_run_conan2)
230222

231223
set(CONAN_HOST_PROFILE "${_args_HOST_PROFILE}" CACHE STRING "Conan host profile" FORCE)
232224
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+
)
234228

235229
# A workaround from https://github.com/conan-io/cmake-conan/issues/595
236230
list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_BINARY_DIR}/conan_provider.cmake")
237231

238232
# Add this to invoke conan even when there's no find_package in CMakeLists.txt.
239233
# 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+
)
241243
endmacro()
242244

243245
#[[.rst:
@@ -298,4 +300,4 @@ macro(run_conan)
298300
else()
299301
_run_conan2(${ARGN})
300302
endif()
301-
endmacro()
303+
endmacro()

0 commit comments

Comments
 (0)