[CMake] Use FIND_LIBRARY to search & link for an executable?

Christian Ehrlicher Ch.Ehrlicher at gmx.de
Fri Sep 18 03:15:20 EDT 2009


> Von: Michael Wild
> 
> On 18. Sep, 2009, at 8:14, Christian Ehrlicher wrote:
> 
> > Hi,
> >
> > I've an external project which made the decision to create an  
> > executable which exports symbols. This means if you want to write a  
> > plugin for this project you have to link your plugin against this  
> > executable.
> > Now I've the problem that FIND_LIBRARY doesn't find this executable.  
> > Does anybody knows a hack to be able to link against an executable  
> > which is not built by the project?
> >
> > I'm really lost here but I can't convince them to fix it... :(
> > Managing an own patch to work around this problem isn't a good long- 
> > term perspective.
> >
> > Thx,
> > Christian
> 
> find_program?
> 
You're right - I did not know that TARGET_LINK_LIBRARIES accepts this.
> And that is a REALLY broken design (and AFAIK only works on Windows).
> 
I'm currently investigating and think it doesn't work on linux at all (which would be very good for me). I'm getting duplicate symbols :)

-->
FIND_PROGRAM(STAGE_LIB STAGE PATHS /opt/3dviewer/bin)
ADD_LIBRARY(dummy SHARED dummy.cpp)
TARGET_LINK_LIBRARIES(dummy ${STAGE_LIB})
-->
/usr/local/bin/c++  -fPIC -g  -shared -Wl,-soname,libdummy.so -o libdummy.so CMakeFiles/dummy.dir/dummy.cpp.o /opt/3dviewer/bin/STAGE
/opt/3dviewer/bin/STAGE: In function `_fini':
/usr/src/packages/BUILD/glibc-2.9/cc-nptl/csu/crti.S:37: multiple definition of `_fini'
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:/usr/src/packages/BUILD/glibc-2.9/cc-nptl/csu/crti.S:37: first defined here
/opt/3dviewer/bin/STAGE: In function `_init':
/usr/src/packages/BUILD/glibc-2.9/cc-nptl/csu/crti.S:25: multiple definition of `_init'
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../lib64/crti.o:/usr/src/packages/BUILD/glibc-2.9/cc-nptl/csu/crti.S:25: first defined here
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: libdummy.so: version node not found for symbol vtable for __cxxabiv1::__class_type_info@@CXXABI_1.3
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: failed to set dynamic section sizes: Bad value
collect2: ld returned 1 exit status
-->

I should have tried this earlier :)

Thx,
Christian

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01


More information about the CMake mailing list