From 9395534368b63f564f5f2cd5c6948113efd28c7f Mon Sep 17 00:00:00 2001 From: tbeu Date: Fri, 23 Feb 2024 21:56:58 +0100 Subject: [PATCH] Fix cmake-lint args in pre-commit hook [ci skip] --- .pre-commit-config.yaml | 5 +++-- cmake/compilerOptions.cmake | 10 +++++----- cmake/test.cmake | 6 +++--- cmake/thirdParties.cmake | 20 ++++++++++---------- 4 files changed, 21 insertions(+), 20 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2b7c3f6..f4b50004 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,7 @@ repos: exclude: cmake/conan.cmake - id: cmake-lint args: - - --linelength=120 - - --spaces=4 + - --line-width=120 + - --tab-size=4 + - --disabled-codes=C0103 exclude: cmake/conan.cmake diff --git a/cmake/compilerOptions.cmake b/cmake/compilerOptions.cmake index 760832ea..d708180c 100644 --- a/cmake/compilerOptions.cmake +++ b/cmake/compilerOptions.cmake @@ -58,11 +58,11 @@ set(SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) # Make the variables HAVE_MAT_UINT8_T, etc... set(TYPES uint8_t uint16_t uint32_t uint64_t int8_t int16_t int32_t int64_t) -foreach(TYPE ${TYPES}) - check_type_size(${TYPE} "SIZEOF_${TYPE}") - set(_mat_${TYPE} ${TYPE}) - string(TOUPPER ${TYPE} TYPE_UPPER) - set(HAVE_MAT_${TYPE_UPPER} ${HAVE_SIZEOF_${TYPE}}) +foreach(type ${TYPES}) + check_type_size(${type} "SIZEOF_${type}") + set(_mat_${type} ${type}) + string(TOUPPER ${type} TYPE_UPPER) + set(HAVE_MAT_${TYPE_UPPER} ${HAVE_SIZEOF_${type}}) if(STDINT_MSVC) set(HAVE_MAT_${TYPE_UPPER} 1) endif() diff --git a/cmake/test.cmake b/cmake/test.cmake index de1df68f..040c3a33 100644 --- a/cmake/test.cmake +++ b/cmake/test.cmake @@ -12,8 +12,8 @@ if(NOT HAVE_SNPRINTF OR UNIX) if(HAVE_LIBM) target_link_libraries(test_snprintf m) endif() - target_include_directories(test_snprintf - PUBLIC ${PROJECT_SOURCE_DIR}/src - PUBLIC ${PROJECT_BINARY_DIR}/src + target_include_directories(test_snprintf PUBLIC + ${PROJECT_SOURCE_DIR}/src + ${PROJECT_BINARY_DIR}/src ) endif() diff --git a/cmake/thirdParties.cmake b/cmake/thirdParties.cmake index f04d1973..86989f09 100644 --- a/cmake/thirdParties.cmake +++ b/cmake/thirdParties.cmake @@ -77,8 +77,8 @@ if(NOT HAVE_HDF5 AND MATIO_MAT73) message(FATAL_ERROR "MAT73 requires HDF5") endif() - -macro(matio_create_zlib target) +# Create the zlib target +macro(MATIO_CREATE_ZLIB target) add_library(MATIO::ZLIB INTERFACE IMPORTED) set_target_properties(MATIO::ZLIB PROPERTIES INTERFACE_LINK_LIBRARIES ${target}) set(ZLIB_FOUND TRUE) @@ -90,23 +90,23 @@ if(MATIO_WITH_ZLIB) endif() if(MATIO_USE_CONAN AND TARGET CONAN_PKG::zlib) - matio_create_zlib(CONAN_PKG::zlib) + MATIO_CREATE_ZLIB(CONAN_PKG::zlib) elseif(HDF5_USE_STATIC_LIBRARIES AND TARGET zlib-static) - matio_create_zlib(zlib-static) + MATIO_CREATE_ZLIB(zlib-static) elseif(HDF5_USE_STATIC_LIBRARIES AND TARGET hdf5::zlib-static) - matio_create_zlib(hdf5::zlib-static) + MATIO_CREATE_ZLIB(hdf5::zlib-static) elseif(NOT HDF5_USE_STATIC_LIBRARIES AND TARGET zlib-shared) - matio_create_zlib(zlib-shared) + MATIO_CREATE_ZLIB(zlib-shared) elseif(NOT HDF5_USE_STATIC_LIBRARIES AND TARGET hdf5::zlib-shared) - matio_create_zlib(hdf5::zlib-shared) + MATIO_CREATE_ZLIB(hdf5::zlib-shared) elseif(TARGET zlib) - matio_create_zlib(zlib) + MATIO_CREATE_ZLIB(zlib) elseif(TARGET ZLIB::ZLIB) - matio_create_zlib(ZLIB::ZLIB) + MATIO_CREATE_ZLIB(ZLIB::ZLIB) else() find_package(ZLIB 1.2.3) if(ZLIB_FOUND) - matio_create_zlib(ZLIB::ZLIB) + MATIO_CREATE_ZLIB(ZLIB::ZLIB) endif() endif()