Is there a best practice for writing CMake file for composition of nodes with subdirectories

asked 2022-09-05 04:45:32 -0500

omer.tal gravatar image

Hey there.

The title is kinda long so allow me to explain what it is that I'm trying to do. I have some nodes that I want to compose into the same executable.

The CMakeLists file of each of these nodes uses add_subdirectory for some in-house infrastracture libraries. Some of these subdirectories are used by some of the wanted nodes for the composition.

The thing is, I couldn't get the composition cmake to build because of these subdirectories. I got all kinds of errors. Is there a general approach to do it? I couldn't find any example.

I was able to fix it by building the nodes as subdirectories of the composition package but there's just got to be a better way.

edit retag flag offensive close merge delete

Comments

Can you please share those errors? Furthermore, I encourage posting an MRE.

ravijoshi gravatar image ravijoshi  ( 2022-09-07 06:31:03 -0500 )edit