tqchen commented on a change in pull request #6515:
URL: https://github.com/apache/incubator-tvm/pull/6515#discussion_r491218858
##########
File path: cmake/util/Util.cmake
##########
@@ -74,3 +74,31 @@ function(assign_source_group group)
source_group("${group}\\${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
+
+cmake_policy(SET CMP0057 NEW) # Needed for IN_LIST used in conditional
Review comment:
see the regex example below
##########
File path: cmake/util/Util.cmake
##########
@@ -74,3 +74,31 @@ function(assign_source_group group)
source_group("${group}\\${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
+
+cmake_policy(SET CMP0057 NEW) # Needed for IN_LIST used in conditional
Review comment:
this might come as a suprise to other cmake modules. would be great if
we can avoid. e.g. we can write a few if after for instead since there are not
a lot of cases
##########
File path: cmake/util/Util.cmake
##########
@@ -74,3 +74,31 @@ function(assign_source_group group)
source_group("${group}\\${_source_path_msvc}" FILES "${_source}")
endforeach()
endfunction(assign_source_group)
+
+cmake_policy(SET CMP0057 NEW) # Needed for IN_LIST used in conditional
+function(DECOMPOSE_ARG SOURCE_VALUE)
+ set(options)
+ set(oneValueArgs ENABLE_VALUE COMMAND_VALUE)
+ set(multiValueArgs)
+ cmake_parse_arguments(ARG "${options}" "${oneValueArgs}" "${multiValueArgs}"
${ARGN})
+ # First check if SOURCE_VALUE is executable
+ execute_process(COMMAND ${SOURCE_VALUE}
+ RESULT_VARIABLE exit_code
+ OUTPUT_VARIABLE dummy
+ OUTPUT_QUIET ERROR_QUIET)
+ string(TOUPPER ${SOURCE_VALUE} UPPER_CASE_SOURCE_VALUE)
+ set(FALSE_VALUES OFF 0 NO FALSE N IGNORE NOTFOUND)
+ if(${SOURCE_VALUE})
+ # If not executable, is it true
+ set(${ARG_ENABLE_VALUE} ON PARENT_SCOPE)
+ unset(${ARG_COMMAND_VALUE} PARENT_SCOPE)
+ elseif(${UPPER_CASE_SOURCE_VALUE} IN_LIST FALSE_VALUES)
Review comment:
perhaps we can do
if (value MATCHS "^(OFF|FALSE|0|N)$")
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]