Check the total number of arguments passed insead of if the ARGV# is defined. This fixes a problem when compling openblas as a subproject of another code.

This commit is contained in:
cianciosa 2021-08-11 12:00:07 -04:00
parent b9e4fb206d
commit c28560129f
1 changed files with 10 additions and 10 deletions

View File

@ -157,31 +157,31 @@ endfunction ()
# STRING - compiles only the given type (e.g. DOUBLE) # STRING - compiles only the given type (e.g. DOUBLE)
function(GenerateNamedObjects sources_in) function(GenerateNamedObjects sources_in)
if (DEFINED ARGV1) if (${ARGC} GREATER 1)
set(defines_in ${ARGV1}) set(defines_in ${ARGV1})
endif () endif ()
if (DEFINED ARGV2 AND NOT "${ARGV2}" STREQUAL "") if (${ARGC} GREATER 2 AND NOT "${ARGV2}" STREQUAL "")
set(name_in ${ARGV2}) set(name_in ${ARGV2})
# strip off extension for kernel files that pass in the object name. # strip off extension for kernel files that pass in the object name.
get_filename_component(name_in ${name_in} NAME_WE) get_filename_component(name_in ${name_in} NAME_WE)
endif () endif ()
if (DEFINED ARGV3) if (${ARGC} GREATER 3)
set(use_cblas ${ARGV3}) set(use_cblas ${ARGV3})
else () else ()
set(use_cblas false) set(use_cblas false)
endif () endif ()
if (DEFINED ARGV4) if (${ARGC} GREATER 4)
set(replace_last_with ${ARGV4}) set(replace_last_with ${ARGV4})
endif () endif ()
if (DEFINED ARGV5) if (${ARGC} GREATER 5)
set(append_with ${ARGV5}) set(append_with ${ARGV5})
endif () endif ()
if (DEFINED ARGV6) if ${ARGC} GREATER 6)
set(no_float_type ${ARGV6}) set(no_float_type ${ARGV6})
else () else ()
set(no_float_type false) set(no_float_type false)
@ -196,7 +196,7 @@ function(GenerateNamedObjects sources_in)
set(real_only false) set(real_only false)
set(complex_only false) set(complex_only false)
set(mangle_complex_sources false) set(mangle_complex_sources false)
if (DEFINED ARGV7 AND NOT "${ARGV7}" STREQUAL "") if (${ARGC} GREATER 7 AND NOT "${ARGV7}" STREQUAL "")
if (${ARGV7} EQUAL 1) if (${ARGV7} EQUAL 1)
set(real_only true) set(real_only true)
elseif (${ARGV7} EQUAL 2) elseif (${ARGV7} EQUAL 2)
@ -342,17 +342,17 @@ endfunction ()
function(GenerateCombinationObjects sources_in defines_in absent_codes_in all_defines_in replace_scheme) function(GenerateCombinationObjects sources_in defines_in absent_codes_in all_defines_in replace_scheme)
set(alternate_name_in "") set(alternate_name_in "")
if (DEFINED ARGV5) if (${ARGC} GREATER 5)
set(alternate_name_in ${ARGV5}) set(alternate_name_in ${ARGV5})
endif () endif ()
set(no_float_type false) set(no_float_type false)
if (DEFINED ARGV6) if (${ARGC} GREATER 6)
set(no_float_type ${ARGV6}) set(no_float_type ${ARGV6})
endif () endif ()
set(complex_filename_scheme "") set(complex_filename_scheme "")
if (DEFINED ARGV7) if (${ARGC} GREATER 7)
set(complex_filename_scheme ${ARGV7}) set(complex_filename_scheme ${ARGV7})
endif () endif ()