'Force CMake to generate zsh friendly command lines

I have a CMake such that when I executed the build (make) in verbose mode, it prints commands such as:

/usr/bin/nvcc -forward-unknown-to-host-compiler -DBOOST_ALL_NO_LIB -DBOOST_CHRONO_DYN_LINK -DBOOST_PP_VARIADICS -DBOOST_TIMER_DYN_LINK -DBOOST_UNIT_TEST_FRAMEWORK_DYN_LINK  --expt-relaxed-constexpr --extended-lambda -Xcudafe "--display_error_number --diag_suppress=implicit_return_from_non_void_function --diag_suppress=class_and_member_name_conflict" --generate-code=arch=compute_61,code=[compute_61,sm_61] -std=c++17 -x cu -c /home/correaa/prj/alf/boost/multi/adaptors/thrust/test/array.cu -o CMakeFiles/array.cu.x.dir/array.cu.o 

presumably, this is a bash-compatible command because I have no problem running it in bash. However it is not a valid zsh command (the shell I use) because it gives an error:

zsh: no matches found: --generate-code=arch=compute_61,code=[compute_61,sm_61]

I presume it is the square brackets that trip zsh [...].

First question is how can I correct manually this command to run on both zsh and bash?

Second question is, is there a way to for CMake to generate makefiles that contain commands that are compatible with zsh?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source