[CMake] need two compilation to achieve success
Bill Hoffman
bill.hoffman at kitware.com
Wed Jun 3 15:46:22 EDT 2009
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
More information about the CMake
mailing list