CHECK_CXX_SYMBOL_EXISTS does not specifiy on docs that it works with checking if an c++ class is in an c++ namespace.
I have an legitimate cmake hell on an project that uses c++ 14/17.
On c++ 17 I can use the following code for the standard filesystem:
#if _has_include(<filesystem>)
#include <filesystem>
namespace fs = std::filesystem;
#else
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
#endif
int main()
{
// use fs namespace from above.
return 0;
}
The problem now is while <filesystem> may be found and std::filesystem might work on gcc and clang on linux, it might fail on mac and windows because they might have the <filesystem> header that has it in std::experimental::filesystem. Making this solution not an overall oneop one. This means that the docs needs refined to explain if it works for checking if class filesystem is in either std or std::experimental and allow the user to define an macro if it is in std, another macro if in experimental.
Also c++ seems to not have an preprocessor for this too sadly without needing cmake to check it either.