robotology / blockfactory

A tiny framework to wrap algorithms for dataflow programming
https://robotology.github.io/blockfactory
GNU Lesser General Public License v2.1
40 stars 16 forks source link

Added BlockFactoryPlugin.cmake #31

Closed diegoferigo closed 5 years ago

diegoferigo commented 5 years ago

Two new CMake functions are included:

They can be used by downstream projects for creating the plugin library. They will substitute the logic of configure_block.

diegoferigo commented 5 years ago

Thanks for the link! target_sources always puzzled me and before reading that post I found it useful just for header-only libraries.

I tried to change this PR to use target_sources but I even if it allowed using add_blockfactory_plugin at a high hierarchy, and then call add_blockfactory_block from subdirectories (which might be useful), this approach has some flaws. Using target_link_libraries is quite difficult with CMake < 3.13, and the constraint of hardcoding ${CMAKE_CURRENT_LIST_DIR} is a no-go in my opinion.

If it can improve the readability, what about renaming add_blockfactory_block to register_blockfactory_block? I can drop a comment in the file to evaluate again the method you proposed when we will support CMake 3.13.

traversaro commented 5 years ago

If it can improve the readability, what about renaming add_blockfactory_block to register_blockfactory_block?

Ok both alternatives for me, target_sources was just just a suggestion, I do not think it is a blocking problem the order of add_blockfactory_block and add_blockfactory_plugin.

diegoferigo commented 5 years ago

I will keep register_blockfactory_block, it is more descriptive of what it actually does.