[CMake] How to handle EXECUTABLE and LIBRARY with the same name?

Eric Noulard eric.noulard at gmail.com
Wed Oct 4 06:45:34 EDT 2006


In my project I have a library

ADD_LIBRARY(tsp_ascii_writer ${ASCII_WRITER_LIB_SRC})

and an executable with the same name

ADD_EXECUTABLE(tsp_ascii_writer ${ASCII_WRITER_SRC})

The exe is linked with the library of the same name.
This is handy since the user may want to use a lib instead
of the ready to use exe.

My trouble is the executable and the library do have
the SAME name and I don't know how to specify that the executable
depends on the library?

ADD_DEPENDENCIES(tsp_ascii_writer tsp_ascii_writer)
does not help.

Finally my question is, is it possible to handle
EXECUTABLE
and
LIBRARY
using the same name.

-- 
Erk


More information about the CMake mailing list