Skip to content

Conversation

@lucasle-sn
Copy link
Contributor

@lucasle-sn lucasle-sn commented Jul 28, 2022

BRIEF_DOCS "Target's source directory"
FULL_DOCS "Identical use as SOURCE_DIR except that this applies to ALL target types, including INTERFACE")

set(project_alias "swiftnav" CACHE STRING "Alias for project")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe you need to make this a cache variable, the following will suffice:

set(SWIFTNAV_ALIAS swiftnav)

Also global variables are captialized

endif()

foreach(target_dependency ${target_dependencies})
if (TARGET ${target_dependency})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to avoid the nesting you use the following technique:

if (TARGET ${target_dependency})
  continue()
endif()

get_target_property(swift_dep_alias ${target_dependency} ALIASED_TARGET)

if (NOT swift_dep_alias)
  continue()
endif()

get_target_property(target_dep_type ${target_dependency} TYPE)
...

Comment on lines +420 to +431
if (NOT TARGET ${SWIFTNAV_ALIAS}::${target_dependency})
continue()
endif()

get_target_property(_swift_dep_alias ${SWIFTNAV_ALIAS}::${target_dependency} ALIASED_TARGET)
if (NOT _swift_dep_alias)
continue()
endif()

if (${_swift_dep_alias} STREQUAL ${target_dependency})
message(WARNING "Linking \"${target_dependency}\" as a dependency of target \"${target}\". Please use alias \"${SWIFTNAV_ALIAS}::${target_dependency}\" instead.")
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra check to ensure the recommended alias is the real alias.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants