forked from andreasbuhr/cppcoro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge: Properly configure Coroutines cmake module
- Loading branch information
Showing
6 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
include(CMakeFindDependencyMacro) | ||
find_dependency(Coroutines QUIET REQUIRED) | ||
find_dependency(Coroutines QUIET REQUIRED COMPONENTS @CXX_COROUTINES_COMPONENT@) | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/cppcoroTargets.cmake") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
cmake_minimum_required(VERSION 3.12) | ||
project(use_cppcoro LANGUAGES CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 20) | ||
find_package(cppcoro REQUIRED) | ||
|
||
add_executable(use_cppcoro use_cppcoro.cpp) | ||
target_link_libraries(use_cppcoro PRIVATE cppcoro::cppcoro) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#include <iostream> | ||
#include <cppcoro/generator.hpp> | ||
|
||
cppcoro::generator<int> sequence() | ||
{ | ||
co_yield 1; | ||
co_yield 22; | ||
co_yield 333; | ||
} | ||
|
||
int main() | ||
{ | ||
for (auto i : sequence()) | ||
{ | ||
std::cout << i << std::endl; | ||
} | ||
} |