Bill Hoffman <bill.hoff...@...> writes:

> No need for all the complication...
> 
> If you already know where the library is going to be:
> 
>   ${CMAKE_CURRENT_BINARY_DIR}/kernels/libkernel_executable.a
> 
> Then link directly to the full path:
> 
> target_link_libraries(main_target
>   ${CMAKE_CURRENT_BINARY_DIR}/kernels/libkernel_executable.a)
> 
> Now the makefiles will depend on that file and it will relink when that 
> .a changes.   This is why link_directories/*link_libraries without a 
> full path to the library is almost always a bad idea...

Sure enough, that works also! I have tried it before but did not realize that if
I want the target depend on a file instead of another target, not only do I have
to specify the full path but also the full filename so "libkernel_executable.a"
is necessary instead of "kernel_executable". In the latter case CMake seems to
believe this is another target, tries to build it and fails. Now it makes
perfect sense, thanks for the help, my problem is solved.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to