Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SelectTdiTarget maintenance #316

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions cmake/SelectTdiTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# The process is:
#
# - Check for each of the legacy xxxx_TARGET Boolean options. Create a list
# of targets we've seen and unset the xxxx_TARGET options.
# of the targets we've seen, and then unset the legacy variables.
#
# - Process the TDI_TARGET=<target> option. Check for errors.
#
Expand All @@ -30,6 +30,7 @@
# TARGETTYPE string specifying the target type (DPDK, ES2K, etc.)
#
# xxxx_TARGET Boolean to enable target-specific cmake code.
# Only the selected target will be defined.
#
# ----------------------------------------------------------------------

Expand All @@ -44,13 +45,15 @@ set(_default_tdi_target DPDK)

#-----------------------------------------------------------------------
# Checks for the specified legacy target option.
# If enabled, returns the target variable name in TARGETVAR.
# Unsets the target variable.
#-----------------------------------------------------------------------
function(_check_legacy_target_option typename TARGETVAR)
unset(${TARGETVAR} PARENT_SCOPE)
set(varname ${typename}_TARGET)
if(${varname})
# Progression: NOTICE (accept), WARNING (accept), FATAL_ERROR (abort).
message(NOTICE "${varname} option is deprecated; use TDI_TARGET=${typename} instead.")
message(WARNING "${varname} option is deprecated; use TDI_TARGET=${typename} instead.")
set(${TARGETVAR} ${typename} PARENT_SCOPE)
endif()
# Eradicate legacy target variable.
Expand All @@ -61,7 +64,8 @@ endfunction()

#-----------------------------------------------------------------------
# Checks for the legacy DPDK_TARGET, ES2K_TARGET, and TOFINO_TARGET
# Boolean options.
# Boolean options. Ensures that no more than one is specified.
# If found, returns the target name in TARGETVAR.
#-----------------------------------------------------------------------
function(_get_legacy_target_option TARGETVAR)
set(legacy_targets)
Expand All @@ -84,6 +88,7 @@ endfunction()

#-----------------------------------------------------------------------
# Checks for the TDI_TARGET=<target> option.
# If valid, converts <target> to upper case and returns it in TARGETVAR.
#-----------------------------------------------------------------------
function(_get_tdi_target_option TARGETVAR)
string(STRIP "${TDI_TARGET}" tdi_target)
Expand Down Expand Up @@ -134,6 +139,7 @@ function(_select_tdi_target_type)
mark_as_advanced(TARGETFLAG)
mark_as_advanced(TARGETTYPE)

# "{Building|Defaulting to} <TARGETFLAG>"
message(NOTICE "${target_action} ${target_flag}")
endfunction()

Expand Down