If I compile on the command-line with g++ directly, I can see everything I need is there:
$ g++ -pthread test.cpp
$ ldd a.out
linux-vdso.so.1 => (0x0
Oh, this was was a pain! I probably lost 2 hours on this. Here is the solution:
CMake uses short 'C' applications to test/try things. If the CMakeLists.txt states that C++ is used for the project, without also listing C, then some of those shorts tests incorrectly fail, and cmake then thinks those things aren't found.
The solution was to change the first line of CMakeLists from this:
PROJECT ( Test CXX )
...to include C as a language:
PROJECT ( Test C CXX )
Then delete build
, recreate it, and everything then works:
rm -rf build
mkdir build
cd build
cmake ..