diff --git a/CMakeLists.txt b/CMakeLists.txt index d1ef00e..6f9bb8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,9 @@ target_sources( errors PUBLIC FILE_SET HEADERS BASE_DIRS include - FILES include/errors/error.hpp + FILES + include/errors/error.hpp + include/errors/format.hpp ) if(NOT SUBPROJECT AND BUILD_TESTING) @@ -55,14 +57,16 @@ if(NOT SUBPROJECT AND BUILD_TESTING) cpmaddpackage(gh:catchorg/Catch2@3.6.0) include(${Catch2_SOURCE_DIR}/extras/Catch.cmake) + cpmaddpackage("gh:fmtlib/fmt#10.2.1") + # Append the main library properties instead of linking the library. get_target_property(errors_SOURCES errors SOURCES) get_target_property(errors_HEADER_DIRS errors HEADER_DIRS) # Build tests for the main library - add_executable(errors_test test/error_test.cpp ${errors_SOURCES}) + add_executable(errors_test test/error_test.cpp test/format_test.cpp ${errors_SOURCES}) target_include_directories(errors_test PRIVATE ${errors_HEADER_DIRS}) - target_link_libraries(errors_test PRIVATE Catch2::Catch2WithMain) + target_link_libraries(errors_test PRIVATE Catch2::Catch2WithMain fmt) # Enable support to check for test coverage include(CheckCoverage) @@ -76,8 +80,6 @@ if(NOT SUBPROJECT AND BUILD_DOCS) target_generate_xml_docs(errors) endif() -add_subdirectory(components) - if(NOT SUBPROJECT AND BUILD_DOCS) add_subdirectory(docs) endif() @@ -87,7 +89,7 @@ if(NOT SUBPROJECT AND BUILD_EXAMPLES) endif() install( - TARGETS errors errors_format + TARGETS errors EXPORT errors_targets LIBRARY DESTINATION lib RUNTIME DESTINATION bin diff --git a/cmake/ErrorsConfig.cmake b/cmake/ErrorsConfig.cmake index 55b6e0a..45684d0 100644 --- a/cmake/ErrorsConfig.cmake +++ b/cmake/ErrorsConfig.cmake @@ -1,2 +1 @@ -find_package(FMT REQUIRED) include(${CMAKE_CURRENT_LIST_DIR}/ErrorsTargets.cmake) diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt deleted file mode 100644 index 1db9315..0000000 --- a/components/CMakeLists.txt +++ /dev/null @@ -1 +0,0 @@ -add_subdirectory(format) diff --git a/components/format/CMakeLists.txt b/components/format/CMakeLists.txt deleted file mode 100644 index ee326ed..0000000 --- a/components/format/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -cpmaddpackage("gh:fmtlib/fmt#10.2.1") - -add_library(errors_format INTERFACE) -target_sources( - errors_format PUBLIC - FILE_SET HEADERS - BASE_DIRS include - FILES include/errors/format.hpp -) -target_link_libraries(errors_format INTERFACE errors fmt) - -if(NOT SUBPROJECT AND BUILD_TESTING) - # Append the main library properties instead of linking the library. - get_target_property(errors_format_HEADER_DIRS errors_format HEADER_DIRS) - get_target_property(errors_format_LIBRARIES errors_format INTERFACE_LINK_LIBRARIES) - - # Build tests for the main library - add_executable(errors_format_test test/format_test.cpp) - target_include_directories(errors_format_test PRIVATE ${errors_format_HEADER_DIRS}) - target_link_libraries(errors_format_test PRIVATE Catch2::Catch2WithMain ${errors_format_LIBRARIES}) - - # Enable support to check for test coverage - include(CheckCoverage) - target_check_coverage(errors_format_test) - - catch_discover_tests(errors_format_test) -endif() - -if(NOT SUBPROJECT AND BUILD_DOCS) - target_generate_xml_docs(errors_format) -endif() diff --git a/docs/CMakeLists.txt b/docs/CMakeLists.txt index 82a4ebb..84c8496 100644 --- a/docs/CMakeLists.txt +++ b/docs/CMakeLists.txt @@ -12,7 +12,6 @@ if(NOT RES EQUAL 0 ) endif() get_target_property(errors_docs_BINARY_DIR errors_docs BINARY_DIR) -get_target_property(errors_format_docs_BINARY_DIR errors_format_docs BINARY_DIR) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/html/index.html @@ -21,8 +20,7 @@ add_custom_command( ${CMAKE_CURRENT_SOURCE_DIR}/conf.py ${CMAKE_CURRENT_SOURCE_DIR}/index.rst ${errors_docs_BINARY_DIR}/errors_docs.stamp - ${errors_format_docs_BINARY_DIR}/errors_format_docs.stamp ) add_custom_target(docs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/html/index.html) -add_dependencies(docs errors_docs errors_format_docs) +add_dependencies(docs errors_docs) diff --git a/docs/conf.py b/docs/conf.py index 04ba115..c022bb0 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -9,11 +9,10 @@ extensions = ['breathe'] subprocess.call('cmake .. -B ../build -D BUILD_DOCS=ON', shell=True) -subprocess.call('cmake --build ../build --target errors_docs --target errors_format_docs', shell=True) +subprocess.call('cmake --build ../build --target errors_docs', shell=True) breathe_projects = { "errors": "../build/errors_docs", - "errors_format": "../build/components/format/errors_format_docs" } html_theme = 'furo' diff --git a/docs/index.rst b/docs/index.rst index 18cce5a..522d55a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -114,11 +114,8 @@ API Docs .. doxygenfunction:: errors::nil :project: errors -Format Component -^^^^^^^^^^^^^^^^ - .. doxygenfunction:: errors::format - :project: errors_format + :project: errors License ------- diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 113427a..aee95ae 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,3 +1,5 @@ +cpmaddpackage("gh:fmtlib/fmt#10.2.1") + add_custom_target(examples) add_executable(example_print_hex print_hex.cpp) @@ -5,5 +7,5 @@ target_link_libraries(example_print_hex PRIVATE errors) add_dependencies(examples example_print_hex) add_executable(example_read_file read_file.cpp) -target_link_libraries(example_read_file PRIVATE errors errors_format) +target_link_libraries(example_read_file PRIVATE errors fmt) add_dependencies(examples example_read_file) diff --git a/components/format/include/errors/format.hpp b/include/errors/format.hpp similarity index 100% rename from components/format/include/errors/format.hpp rename to include/errors/format.hpp diff --git a/components/format/include/errors/format.ipp b/include/errors/format.ipp similarity index 100% rename from components/format/include/errors/format.ipp rename to include/errors/format.ipp diff --git a/components/format/test/format_test.cpp b/test/format_test.cpp similarity index 100% rename from components/format/test/format_test.cpp rename to test/format_test.cpp