eliemichel / OpenMfx

A low-overhead mesh-processing plug-in API for cross-software procedural effects
https://openmfx.org
Other
161 stars 6 forks source link

Fix CMakeLists duplicate target definition #13

Closed tkarabela closed 3 years ago

tkarabela commented 3 years ago

I've tried to add_subdirectory(OpenMeshEffect) in MfxVTK and had to make this change to get CMake to build on Linux. It just skips definition if target already exists, so hopefully it shouldn't break anything.

Not sure why the target definition is necessary in the first place, unless one is using CppPluginSupport/CMakeLists.txt directly and not through ./CMakeLists.txt. I use CLion on Linux, which identifies the project with the top-level CMakeList and builds targets from that. Maybe it's a MS Visual Studio thing? I don't know. Anyway, it should be working now.

eliemichel commented 3 years ago

Okey! Actually I originally did not want to define openmesheffect again in here, but for some reason that I really could not find this CMakeLists was not aware of the fact that openmesheffect target is defined in the parent directory. Does it work for you, to just drop the definition of openmesheffect target from CppPluginSupport/CMakeLists.txt?

tkarabela commented 3 years ago

Does it work for you, to just drop the definition of openmesheffect target from CppPluginSupport/CMakeLists.txt?

Yes, I can compile MfxVTK when I just add_subdirectory(OpenMeshEffect) while not having the openmesheffect target at all in CppPluginSupport/CMakeLists.txt. In the patch, I put it behind condition instead of removing it entirely just to be sure I didn't break it for anyone else.

Though it shouldn't be necessary, as long one does add_subdirectory(OpenMeshEffect) instead of add_subdirectory(OpenMeshEffect/CppPluginSupport).