From 2f54023f5148ac13bb825c61fc568cb26a61978b Mon Sep 17 00:00:00 2001 From: Alexander Karzhenkov Date: Sat, 23 Jan 2021 16:30:48 +0500 Subject: [PATCH] Properly configure installed Coroutines module --- CMakeLists.txt | 8 +++++++- cmake/cppcoroConfig.cmake | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 005d0827..d5bbfc57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,12 +18,18 @@ if(BUILD_TESTING) add_subdirectory(test) endif() +if(CXX_COROUTINES_HEADER STREQUAL coroutine) + set(CXX_COROUTINES_COMPONENT Final) +else() + set(CXX_COROUTINES_COMPONENT Experimental) +endif() + export(EXPORT cppcoroTargets FILE "${PROJECT_BINARY_DIR}/cppcoro/cppcoroTargets.cmake" NAMESPACE cppcoro::) configure_file(cmake/cppcoroConfig.cmake "${PROJECT_BINARY_DIR}/cppcoro/cppcoroConfig.cmake" - COPYONLY) + @ONLY) configure_file(cmake/FindCoroutines.cmake "${PROJECT_BINARY_DIR}/cppcoro/FindCoroutines.cmake" COPYONLY) diff --git a/cmake/cppcoroConfig.cmake b/cmake/cppcoroConfig.cmake index 0b9f9c0b..0ab5ce1c 100644 --- a/cmake/cppcoroConfig.cmake +++ b/cmake/cppcoroConfig.cmake @@ -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")