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