[CMake] need two compilation to achieve success

eial at cs.bgu.ac.il eial at cs.bgu.ac.il
Wed Jun 3 16:01:06 EDT 2009


On Wed 03 Jun 22:46 2009 Bill Hoffman wrote:
> eial at cs.bgu.ac.il wrote:
> 
> > 
> > thanks for the tip though but my current problem is in regards to the
> > linking of external libs, I've used to add them to the
> > TARGET_LINK_LIBRARIES but it was suggested here not to use it in that
> > way. 
> OK, I think I see the problem.  For external libraries, you should use 
> find_library and link them in the target_link_libraries.  For 
> internal(things built by CMake), you should just use the name.
> 
> For example
> 
> add_library(foo SHARED foo.c)
> find_library(BAR_LIB bar)  # find path to bar
> target_link_libraries(foo ${BAR_LIB}) # link bar to foo
> add_executable(car car.c)
> target_link_libraries(car foo) # this will link foo and bar to car
> 
> -Bill
> 
thanks for your help, this solved the issue though I have another problem which isn't cmake based.
thanks for your patience.





More information about the CMake mailing list