Unsure about how to use CMake properly here. I have one library, which is a template header only library which uses C++20 features. Therefore, I want to make sure that any [downstream/consumer/dependent] of my library compiles the specialization of my library with the correct flags.
First lib does the following:
add_library(foo INTERFACE include/foo.h)
Now, foo
uses the filesystem stuff from c++20, so I want to do something like this:
target_compile_features(foo INTERFACE cxx_std_20)
target_link_libraries(foo INTERFACE stdc++fs)
In my dependent, I then want to do
add_executable(bar src/bar.cpp)
find_package(foo REQUIRED)
target_link_libraries(bar foo)
// src/bar.cpp
#include "foo.h" // or something like that
Currently, linker fails. What's the proper way to set this up?