Suppose project Foo depends on a library Bar that uses C++ internally, but
was not properly linked, so foo would need to be linked with

1. $CC -shared -o libfoo.so *.o -lbar -lstdc++

or

2. $CXX -shared -o libfoo.so *.o -lbar


Note that

find_library (LIBSTDCXX NAMES stdc++)

does not work because this library is often not in a public directory, so a
full path cannot be resolved. My understanding is that current recommended
practice is to use option 2 above, but this breaks down if Foo also needs to
link some Fortran libraries because you can't link using both the C++
compiler and the Fortran compiler.

If the Fortran and C++ compilers come from the same suite, passing a literal
"-lstdc++" will generally work, but this is not robust if they come from
different suites. Is there a way to mark a library as depending on a
language or some other internal compiler library, so that CMake will sort
out how to do the multi-language link in the same way it does if the project
has source files in each language?
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to