Skip to content
Merged
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
12 changes: 5 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@ if(CTH_ENABLE_TESTS)
enable_testing()
endif()

# exported
# exported, a parent project turns components off with set(CTH_BUILD_<COMPONENT> OFF)
add_subdirectory(cth)
add_subdirectory(cth_os)
add_subdirectory(cth_coro)
add_subdirectory(cth_net)
if(WIN32)
add_subdirectory(cth_win)
endif()
cth_add_subdirectory(cth_os CTH_BUILD_OS)
cth_add_subdirectory(cth_coro CTH_BUILD_CORO)
cth_add_subdirectory(cth_net CTH_BUILD_NET)
cth_add_subdirectory(cth_win CTH_BUILD_WIN WIN32)

cth_create_package()

Expand Down
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,23 @@ find_package(cth CONFIG REQUIRED COMPONENTS coro)
target_link_libraries(app PRIVATE cth::coro)
```

or add the source as a subdirectory, options turn components off:

```cmake
set(CTH_BUILD_NET OFF)
add_subdirectory(lib/cth)
target_link_libraries(app PRIVATE cth::os)
```

api not stable yet, no versioned releases

## components
- `cth`, `os`, `coro`
- `cth`, `os`, `coro`, `net`
- windows only: `win`, `win_capture`

## options
- `CTH_BUILD_OS`, `CTH_BUILD_CORO`, `CTH_BUILD_NET`: default ON
- `CTH_BUILD_WIN`: default ON on windows

# license
[MIT](LICENSE)
4 changes: 4 additions & 0 deletions cth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ cth_pkg_target_include_directories(

target_compile_options(cth INTERFACE $<$<CXX_COMPILER_ID:MSVC>:/Zc:preprocessor>)

# cth/hash/hash_aggregates.hpp includes boost/pfr.hpp
cth_pkg_target_find_package(cth boost_pfr CONFIG REQUIRED)
target_link_libraries(cth INTERFACE Boost::pfr)

target_link_libraries(cth INTERFACE $<$<AND:$<CXX_COMPILER_ID:GNU,Clang>,$<NOT:$<PLATFORM_ID:Windows>>>:stdc++exp>)

# tests
Expand Down
2 changes: 2 additions & 0 deletions cth_coro/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cth_assert_target(cth::os REASON "cth_coro requires cth_os (CTH_BUILD_OS)")

cth_glob_cpp(CTH_CORO_SRC "src")
cth_glob_cpp(CTH_CORO_INCL "incl")

Expand Down
2 changes: 2 additions & 0 deletions cth_net/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cth_assert_target(cth::os REASON "cth_net requires cth_os (CTH_BUILD_OS)")

cth_glob_cpp(CTH_NET_SRC "src")
cth_glob_cpp(CTH_NET_INCL "incl")

Expand Down
4 changes: 4 additions & 0 deletions cth_win/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
cth_assert_true(WIN32 REASON "cth_win targets windows")
cth_assert_target(cth::os REASON "cth_win requires cth_os (CTH_BUILD_OS)")
cth_assert_target(cth::coro REASON "cth_win requires cth_coro (CTH_BUILD_CORO)")

cth_glob_cpp(CTH_WIN_SRC "src")
cth_glob_cpp(CTH_WIN_INCL "incl")

Expand Down
Loading