No subject


Tue Nov 2 11:10:42 EDT 2010


In the kernels folder strange things (have to) happen: first the kernel.cpp is
compiled with a custom compiler (I use a combination of SET, CMAKE_C_COMPILER
and ADD_EXECUTABLE), then this binary is converted into a library using a custom
POST_BUILD command that calls a special tool to do just that. If the binary is
called kernel_executable_bin, the custom command generates a file
libkernel_executable.a

Now I have to link this library to my main executable (built from main.cpp).
What I did so far is to put in the kernels/CMakeLists.txt file:

add_dependencies(main_target kernel_executable_bin)

and in the /CMakeLists.txt file:

link_directories("${CMAKE_CURRENT_BINARY_DIR}/kernels/")
target_link_libraries(main_target kernel_executable)

This works as expected for one ugly flaw: if I only change kernels/kernel.cpp it
won't relink the main_target. I have thus far been unsuccessful in getting this
to work. I've tried various combinations of add_library(STATIC IMPORTED) and
add_custom_target(DEPENDS) but it won't work.

Any ideas would be greatly appreciated.
Sebastian



More information about the CMake mailing list