I’m building app with boost.python. I want to make each cpp-module as a single shared library.
I have a list of cpp-files, how to make in cycle different subprojects with name taken from cpp file?
For example:
set(Script_srcs
Module1.cpp
Module2.cpp
Module3.cpp
)
some_cycle
add_library( {NAME} SHARED {PATH} )
Thanks.
You could use foreach to iterate over your source-files and use a the function get_filename_component with NAME_WE to get only the filename, something like:
But, instead of deriving library-names from filenames, why not work the other way around? Derive your filenames from the desired module-names and append “.cpp” in the for-loop: