How specifically do I use the -v invocation to see details on a cmake linker error? I found two existing questions about using this option, but one is for Xcode builds and the other for NDK builds. They are here:
How to use cmake -v invocation to help find linker error
I am on OSX Mojave. I am using a standard cmakelists.txt approach, and the error is this:
Undefined symbols for architecture x86_64:
"Image::createImage(int, int, int)", referenced from:
_main in tutorial.cpp.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
A comment in a SO question shows what I am trying to do:
...you could use -v to see the linker invocation to see what's going wrong. It would show you this link line:
"/usr/bin/ld" -demangle -dynamic -arch x86_64
-macosx_version_min 10.6.8 -o a.out -lcrt1.10.6.o
/var/folders/zl/zlZcj24WHvenScwjPFFFQE+++TI/-Tmp-/cc-hdOL8Z.o
-lSystem /Developer/usr/bin/../lib/clang/3.0/lib/darwin/libclang_rt.osx.a
(I'm a cmake rookie btw) I have tried all of the following in my cmakelists.txt but they did not work:
add_link_options(-v)
add_link_options("-v")
target_link_options(myexec PUBLIC -v)
target_link_options(myexec PUBLIC "-v")
target_link_options(myexec PUBLIC "LINKER:-v")