cpp_vcpkg_project icon indicating copy to clipboard operation
cpp_vcpkg_project copied to clipboard

Another example where my_lib is a shared library

Open nejcgalof opened this issue 3 years ago • 2 comments

It is possible to create another example like my_lib where my_lib is a shared library (.so). I try it, but I have problems when I link it to the tests. It is good practice to test a shared library in this way, or is it better to create a static and shared library, and link a static to the tests?

nejcgalof avatar Jul 15 '22 08:07 nejcgalof

Specially I have the problem with target_link_libraries(demo_shared PRIVATE project_options project_warnings). Then got the error:

/usr/bin/ld: /lib/x86_64-linux-gnu/libasan.so.6: warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /lib/x86_64-linux-gnu/libasan.so.6: warning: the use of `tempnam' is dangerous, better use `mkstemp'
/usr/bin/ld: /lib/x86_64-linux-gnu/libasan.so.6: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
==18105==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
==18106==ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
CMake Error at /root/.conan/data/catch2/2.13.9/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib/cmake/Catch2/CatchAddTests.cmake:79 (message):
  "xml" is not a valid reporter!

Because of this, an example of a shared library will be good.

nejcgalof avatar Jul 15 '22 11:07 nejcgalof

We should be able to do that by setting BUILD_SHARED_LIBS for my_lib.

aminya avatar Jul 15 '22 18:07 aminya