Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,26 @@ 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)
# Import Catch2 as the main testing framework
cpmaddpackage(gh:catchorg/[email protected])
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)
Expand All @@ -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()
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion cmake/ErrorsConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
find_package(FMT REQUIRED)
include(${CMAKE_CURRENT_LIST_DIR}/ErrorsTargets.cmake)
1 change: 0 additions & 1 deletion components/CMakeLists.txt

This file was deleted.

31 changes: 0 additions & 31 deletions components/format/CMakeLists.txt

This file was deleted.

4 changes: 1 addition & 3 deletions docs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
3 changes: 1 addition & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
5 changes: 1 addition & 4 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,8 @@ API Docs
.. doxygenfunction:: errors::nil
:project: errors

Format Component
^^^^^^^^^^^^^^^^

.. doxygenfunction:: errors::format
:project: errors_format
:project: errors

License
-------
Expand Down
4 changes: 3 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
cpmaddpackage("gh:fmtlib/fmt#10.2.1")

add_custom_target(examples)

add_executable(example_print_hex print_hex.cpp)
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)
File renamed without changes.
File renamed without changes.
File renamed without changes.