target_sources and multiple subdirs

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

target_sources and multiple subdirs

Michael Jackson

I have a project where we have a bunch of plugins that are compiled. We are currently wrapping with Pybind11 to access those libraries from Python. The issue on windows is that we get a multiple DLL load error and our thought was to create 1 enormous python module library (Not sure if this is the right idea or not….)

 

So my question has to do with how to add files to a target that might initially get created about 3 subdirs down from the top level CMakeLists.txt file but each time cmake runs through a CMake file that would configure a plugin can we just keep adding files to the python module target through the use of target_sources() command. Not sure how that works or if that idea would work.

 

Thoughts or pointers would be very much welcome.

 

--

Michael Jackson | Owner, President

      BlueQuartz Software

[e] [hidden email]

[w] www.bluequartz.net


--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: target_sources and multiple subdirs

Craig Scott-3


On Thu, Jun 21, 2018 at 2:47 AM, Michael Jackson <[hidden email]> wrote:

I have a project where we have a bunch of plugins that are compiled. We are currently wrapping with Pybind11 to access those libraries from Python. The issue on windows is that we get a multiple DLL load error and our thought was to create 1 enormous python module library (Not sure if this is the right idea or not….)

 

So my question has to do with how to add files to a target that might initially get created about 3 subdirs down from the top level CMakeLists.txt file but each time cmake runs through a CMake file that would configure a plugin can we just keep adding files to the python module target through the use of target_sources() command. Not sure how that works or if that idea would work.

 

Thoughts or pointers would be very much welcome.



You should be able to use target_sources() to do that, although I'd recommend you create the target higher up rather than burying it deeper down in the subdirs. It would seem more logical to create the target at the point above where all the subdirs that add sources are. Maybe have a read of the following article for a more detailed discussion of using target_sources() in this way:


--
Craig Scott
Melbourne, Australia

--

Powered by www.kitware.com

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

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

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

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