Hi,

I have a somewhat weird setup to build binaries for the Cell processor:

|-- CMakeLists.txt
|-- kernels
|   |-- CMakeLists.txt
|   `-- kernel.cpp
`-- main.cpp

>From the main.cpp in the root directory the executable is built. 

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

_______________________________________________
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