cburstedde / p4est

The "p4est" forest-of-octrees library
www.p4est.org/
GNU General Public License v2.0
261 stars 115 forks source link

Check if libsc is already a known target. #301

Closed jmark closed 7 months ago

jmark commented 7 months ago

Check if libsc is already a known target.

Proposed changes:

This PR adds a check if libsc is already a known target in the CMake build system. If this is the case, registering libsc is skipped.

This is useful for cases when p4est is included as dependency by other software projects, e.g. t8code, which in turn also depends on libsc. If this check would not be there CMake registers libsc twice which causes conflicts.

jmark commented 7 months ago

@sandro-elsweijer @svengoldberg Feel free to comment if you see room for improvement.

cburstedde commented 7 months ago

Thanks; well spotted. @scivision, would you think this works given other hierarchical projects?

scivision commented 7 months ago

I would use

if(NOT TARGET SC::SC)

as both targets have the same scope. The "SC::SC" is a bit easier to grok when finding where something came from.

jmark commented 7 months ago

I would use

if(NOT TARGET SC::SC)

as both targets have the same scope. The "SC::SC" is a bit easier to grok when finding where something came from.

@scivision I applied your suggestion. Thanks for the advice!

cburstedde commented 7 months ago

Thanks so much @jmark and @scivision!