Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Sep 1, 2023
1 parent d3886c3 commit 44336a0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 18 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ else()
cmake_policy(VERSION 3.25)
endif()

if (NOT UNITS_CMAKE_PROJECT_NAME)
set(UNITS_CMAKE_PROJECT_NAME UNITS)
if(NOT UNITS_CMAKE_PROJECT_NAME)
set(UNITS_CMAKE_PROJECT_NAME UNITS)

endif()

project(
Expand Down Expand Up @@ -72,7 +72,9 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
endif()

list(APPEND CMAKE_MODULE_PATH "${${UNITS_CMAKE_PROJECT_NAME}_SOURCE_DIR}/config")
list(APPEND CMAKE_MODULE_PATH "${${UNITS_CMAKE_PROJECT_NAME}_SOURCE_DIR}/ThirdParty/cmake")
list(APPEND CMAKE_MODULE_PATH
"${${UNITS_CMAKE_PROJECT_NAME}_SOURCE_DIR}/ThirdParty/cmake"
)

# Allow IDE's to group targets into folders
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
Expand Down Expand Up @@ -212,17 +214,15 @@ elseif(UNITS_ENABLE_TESTS)
endif()
endif()




if(UNITS_INSTALL)
if(UNITS_BUILD_STATIC_LIBRARY)
install(TARGETS compile_flags_target ${UNITS_LIBRARY_EXPORT_COMMAND})
endif()
if(NOT UNITS_BINARY_ONLY_INSTALL)
include(CMakePackageConfigHelpers)
configure_file(
config/unitsConfig.cmake.in "${PROJECT_BINARY_DIR}/${UNITS_LC_PROJECT_NAME}Config.cmake" @ONLY
config/unitsConfig.cmake.in
"${PROJECT_BINARY_DIR}/${UNITS_LC_PROJECT_NAME}Config.cmake" @ONLY
)

export(
Expand Down
8 changes: 6 additions & 2 deletions FuzzTargets/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

add_executable(fuzz_from_string fuzz_target_from_string.cpp)
target_link_libraries(fuzz_from_string ${UNITS_LC_PROJECT_NAME}::units compile_flags_target)
target_link_libraries(
fuzz_from_string ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
)
target_include_directories(fuzz_from_string PRIVATE ${CMAKE_SOURCE_DIR}/ThirdParty)

add_executable(fuzz_measurement fuzz_target_measurement_from_string.cpp)
target_link_libraries(fuzz_measurement ${UNITS_LC_PROJECT_NAME}::units compile_flags_target)
target_link_libraries(
fuzz_measurement ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
)
target_include_directories(fuzz_measurement PRIVATE ${CMAKE_SOURCE_DIR}/ThirdParty)

add_custom_target(
Expand Down
4 changes: 3 additions & 1 deletion converter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ cmake_dependent_option(

if(UNITS_BUILD_CONVERTER_APP)
add_executable(units_convert converter.cpp)
target_link_libraries(units_convert PUBLIC ${UNITS_LC_PROJECT_NAME}::units compile_flags_target)
target_link_libraries(
units_convert PUBLIC ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
)
target_include_directories(units_convert PRIVATE ${PROJECT_SOURCE_DIR}/ThirdParty)
target_compile_definitions(
units_convert PUBLIC UNITS_VERSION_STRING="${UNITS_VERSION}"
Expand Down
11 changes: 8 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ if(UNITS_HEADER_ONLY)
foreach(T ${UNIT_TEST_HEADER_ONLY})

add_unit_test(${T}.cpp)
target_link_libraries(${T} ${UNITS_LC_PROJECT_NAME}::header_only compile_flags_target)
target_link_libraries(
${T} ${UNITS_LC_PROJECT_NAME}::header_only compile_flags_target
)
if(MSVC)
target_compile_options(${T} PRIVATE /wd4459)
endif()
Expand Down Expand Up @@ -68,7 +70,9 @@ else()
)

add_unit_test(test_leadingNumbers.cpp)
target_link_libraries(test_leadingNumbers ${UNITS_LC_PROJECT_NAME}::units compile_flags_target)
target_link_libraries(
test_leadingNumbers ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
)
if(UNITS_CLANG_TIDY)
set_property(TARGET ${T} PROPERTY CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()
Expand Down Expand Up @@ -134,7 +138,8 @@ else()
target_compile_options(test_all_unit_base PRIVATE /wd4459)
endif()
target_link_libraries(
test_all_unit_base gtest gmock gtest_main ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
test_all_unit_base gtest gmock gtest_main ${UNITS_LC_PROJECT_NAME}::units
compile_flags_target
)
set_target_properties(test_all_unit_base PROPERTIES FOLDER "Tests")
# test_all_unit_base should not be added to the tests it will take a long time run
Expand Down
10 changes: 7 additions & 3 deletions units/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ if(UNITS_BUILD_SHARED_LIBRARY)

elseif(UNITS_BUILD_OBJECT_LIBRARY)
add_library(units OBJECT ${units_source_files} ${units_header_files})
target_include_directories(units PRIVATE $<BUILD_INTERFACE:${${UNITS_CMAKE_PROJECT_NAME}_SOURCE_DIR}>)
target_include_directories(
units PRIVATE $<BUILD_INTERFACE:${${UNITS_CMAKE_PROJECT_NAME}_SOURCE_DIR}>
)

if(UNITS_NAMESPACE)
target_compile_definitions(units PUBLIC -DUNITS_NAMESPACE=${UNITS_NAMESPACE})
Expand Down Expand Up @@ -146,7 +148,7 @@ elseif(UNITS_BUILD_STATIC_LIBRARY)
set_property(TARGET units PROPERTY CXX_CLANG_TIDY "${DO_CLANG_TIDY}")
endif()
add_library(${UNITS_LC_PROJECT_NAME}::units ALIAS units)
message(status "adding library ${UNITS_LC_PROJECT_NAME}::units")
message(STATUS "adding library ${UNITS_LC_PROJECT_NAME}::units")
endif()

# add the header only interface library
Expand All @@ -172,7 +174,9 @@ endif()
add_library(${UNITS_LC_PROJECT_NAME}::header_only ALIAS header_only)

if(UNITS_INSTALL AND NOT UNITS_BINARY_ONLY_INSTALL)
install(FILES ${units_header_files} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${UNITS_LC_PROJECT_NAME})
install(FILES ${units_header_files}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${UNITS_LC_PROJECT_NAME}
)
if(UNITS_BUILD_SHARED_LIBRARY OR BUILD_SHARED_LIBS)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/units_export.h
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${UNITS_LC_PROJECT_NAME}
Expand Down
3 changes: 2 additions & 1 deletion webserver/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ if(CMAKE_VERSION VERSION_GREATER 3.12)
find_package(Boost 1.70.0 REQUIRED)
add_executable(units_webserver unit_web_server.cpp)
target_link_libraries(
units_webserver PUBLIC ${UNITS_LC_PROJECT_NAME}::units compile_flags_target Boost::boost
units_webserver PUBLIC ${UNITS_LC_PROJECT_NAME}::units compile_flags_target
Boost::boost
)

target_compile_definitions(units_webserver PUBLIC BOOST_DATE_TIME_NO_LIB)
Expand Down

0 comments on commit 44336a0

Please sign in to comment.