Skip to content

Commit

Permalink
build: modify errors_format target to be interface library
Browse files Browse the repository at this point in the history
  • Loading branch information
threeal committed Jan 4, 2024
1 parent 3213cbc commit b22555d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions components/format/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
cpmaddpackage("gh:fmtlib/fmt#10.2.0")

add_library(errors_format src/format.cpp)
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 PUBLIC errors fmt)
target_link_libraries(errors_format INTERFACE errors fmt)

if(NOT_SUBPROJECT)
if (BUILD_TESTING)
# Append the main library properties instead of linking the library.
get_target_property(errors_format_SOURCES errors_format SOURCES)
get_target_property(errors_format_HEADER_DIRS errors_format HEADER_DIRS)
get_target_property(errors_format_LIBRARIES errors_format LINK_LIBRARIES)
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 ${errors_format_SOURCES})
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})

Expand Down
Empty file removed components/format/src/format.cpp
Empty file.

0 comments on commit b22555d

Please # to comment.