Getting CMake to give an error/warning about unreferenced symbols -


i'm wondering how go making cmake produce error, or @ least warning, when linker cannot find symbols referenced in source file?

for example, let's have foo.c:

#include "bar.h" //bar.h provides bar()  void foo(void) {   bar()   return; } 

in case building static library, if not smart how have used add_library() directive, default behavior seems to not give warning bar unreferenced symbols in foo's object archive file (.a)

there's -z now gcc linker these days, yeah, isn't cmake's problem.

the fool-proof way i've found works on shared libraries, write test each shared library , dlopen(path, rtld_now) (and similar windows) , use return value test return value. list of shared objects, have wrapper function around add_library adds shared libraries global property used generate tests dynamically. remember there being way tell if target shared or static, i'm not finding docs right now.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -