[CMake] need two compilation to achieve success

eial at cs.bgu.ac.il eial at cs.bgu.ac.il
Tue Jun 2 00:33:23 EDT 2009


On Mon 01 Jun 20:56 2009 Bill Hoffman wrote:
> eial at cs.bgu.ac.il wrote:
> > On Mon 01 Jun 15:28 2009 Bill Hoffman wrote:
> >> eial at cs.bgu.ac.il wrote:
> >>> On Mon 01 Jun 8:18 2009 Tyler Roscoe wrote:
> >>> thanks for the tip, it solved the issue.
> >>>
> >>>
> >> I am glad that worked for you but something else is wrong...  How are 
> >> you linking bin/libs/libAgathaUtils.so' to `bin/AgathaHud' ?  You should 
> >> have something like:
> >>
> >> target_link_libraries(AgathaHud AgathaUtils)
> >>
> >> That should add the dependency for you.   Do you have that?
> >>
> >> -Bill
> >>
> > 
> > I have this:
> > TARGET_LINK_LIBRARIES(AgathaHud ${LIBRARY_OUTPUT_PATH}/libAgathaUtils.so 
> >                                 ${LIBRARY_OUTPUT_PATH}/libAgathaEngine.so
> >                                 ${LIBRARY_OUTPUT_PATH}/libAgathaThreads.so
> >                                 cv
> >                                 PocoXML
> >                                 PocoFoundation
> >                                 AR
> >                                 ARMulti
> >                                 ARvideo)
> > 
> > 
> 
> OK, that is not correct.  For targets that CMake builds, you can just 
> use the target name.  What you have now will only work on some systems 
> and not work if you use OUTPUT_NAME or other properties on those 
> libraries.
> 
> You want:
> target_link_libraries(AgathaHud AgathaUtils AgathaEntine AgathaThreads)
> 
> That is assuming that AgathaUtils AgathaEntine AgathaThreads are all 
> built in the same project by CMake.
> 
> -Bill
> 

yes they are built in the same project.
changing you your suggestions results in two new problems:
1) removing ${LIBRARY_OUTPUT_PATH} results in "/usr/lib/gcc/x86_64-pc-linux-gnu/4.3.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lAgathaUtils" error, the structure of the output dir is bin for the binary and bin/libs for the libs.
2) with ${LIBRARY_OUTPUT_PATH}, compilation fails due to unknown reference to all vars and functions that are part of the external libs.
I've encountered this before and that was the only way that I've found to solve it.






More information about the CMake mailing list