Skip to content

Commit

Permalink
build: utilize FixFormat.cmake (#115)
Browse files Browse the repository at this point in the history
* build: utilize FixFormat.cmake

* build: remove Format.cmake

* build: add `format` target
  • Loading branch information
threeal authored Jan 16, 2024
1 parent 03764fc commit d28bea4
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
9 changes: 8 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR AND BUILD_TESTING)
include(CheckWarning)
add_check_warning()

find_package(Format REQUIRED)
find_package(FixFormat REQUIRED)
include(FixFormat)
target_fix_format(sequence)
target_fix_format(generate_sequence)

find_package(Catch2 REQUIRED)

Expand All @@ -44,9 +47,13 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR AND BUILD_TESTING)

include(CheckCoverage)
target_check_coverage(sequence_test)
target_fix_format(sequence_test)

include(Catch)
catch_discover_tests(sequence_test)

add_custom_target(format)
add_dependencies(format sequence_format generate_sequence_format sequence_test_format)
endif()

install(
Expand Down
9 changes: 2 additions & 7 deletions cmake/CPM.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,8 @@ function(cpm_add_check_warning)
cpmaddpackage(gh:threeal/CheckWarning.cmake@2.1.0)
endfunction()

function(cpm_add_format)
cpmaddpackage(
Format.cmake
VERSION 1.7.3
GITHUB_REPOSITORY TheLartians/Format.cmake
OPTIONS "FORMAT_SKIP_CMAKE ON"
)
function(cpm_add_fix_format)
cpmaddpackage(gh:threeal/FixFormat.cmake@1.0.0)
endfunction()

function(cpm_add_catch2)
Expand Down
13 changes: 13 additions & 0 deletions cmake/FindFixFormat.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
if(FixFormat_FOUND)
return()
endif()

find_package(FixFormat QUIET CONFIG)
if(FixFormat_FOUND)
return()
endif()

include(CPM)
cpm_add_fix_format()

list(APPEND CMAKE_MODULE_PATH ${FixFormat_SOURCE_DIR}/cmake)
2 changes: 0 additions & 2 deletions cmake/FindFormat.cmake

This file was deleted.

0 comments on commit d28bea4

Please sign in to comment.