cppcoro icon indicating copy to clipboard operation
cppcoro copied to clipboard

problems using cmake target on macos

Open pbrady opened this issue 3 years ago • 1 comments

Using apple-clang@13, I can successfully build, install, and run the tests via ctest. The cmake modules detect that apple-clang needed the -fcoroutines-ts flag and everything succeeds. But for some reason, when consuming cppcoro from another cmake project, I get the following error:

CMake Error at /Users/ptb/gitrepos/cppcoro/install/lib/cmake/cppcoro/FindCoroutines.cmake:281 (message):
  Cannot compile simple program using std::coroutines.  Is C++17 or later
  activated?
Call Stack (most recent call first):
  /usr/local/Cellar/cmake/3.22.1/share/cmake/Modules/CMakeFindDependencyMacro.cmake:47 (find_package)
  /Users/ptb/gitrepos/cppcoro/install/lib/cmake/cppcoro/cppcoroConfig.cmake:4 (find_dependency)
  CMakeLists.txt:28 (find_package)

The project does specify c++20 and CMakeOutput.log records the success before failing with the above message:

Performing C++ SOURCE FILE Test _CXX_COROUTINES_SUPPORTS_TS_FLAG succeeded with the following output:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -D_CXX_COROUTINES_SUPPORTS_TS_FLAG  -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk -mmacosx-version-min=11.6   -fcoroutines-ts -std=c++2a -MD -MT CMakeFiles/cmTC_ca8c4.dir/src.cxx.o -MF CMakeFiles/cmTC_ca8c4.dir/src.cxx.o.d -o CMakeFiles/cmTC_ca8c4.dir/src.cxx.o -c /Users/ptb/gitrepos/raytracing/build/CMakeFiles/CMakeTmp/src.cxx

It seems like the successful detection is not percolating up.

pbrady avatar Jan 29 '22 04:01 pbrady

PR #34 fixes this issue.

pbrady avatar Jan 30 '22 04:01 pbrady