[CMake] cmake trouble

Klaim - Joël Lamotte mjklaim at gmail.com
Mon Oct 22 11:42:44 EDT 2012


Hi,

On Mon, Oct 22, 2012 at 5:35 PM, 张峰 <fangler2012 at 126.com> wrote:

>
> 1.if i put "TARGET_LINK_LIBRARIES(fan test)" before ADD_EXECUTABLE
> command,this does not work ,why??
>

Because until yout call add_executable(), the target name doesn't exist.
You have to use the target name as first parameter of
target_link_libraries().


>
> 2. but if i  ADD_LIBRARY(test STATIC ${LIBTEST_SRC} ${LIBHELLO_SRC}) ,it
> is  ok,why ??
>


I don't understand the question.


>
> 3.if i put "TARGET_LINK_LIBRARIES(fan test)" after ADD_EXECUTABLE
> command,it works ,why ??
>
>

For the reason I explained in 1.

Joel Lamotte
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121022/42e6d33f/attachment.htm>


More information about the CMake mailing list