# Re: Illegal CustomBuild for MSVC 18

**URL:** <https://www.ruby-forum.com/t/re-illegal-custombuild-for-msvc-18/242323>\
**Category:** GNU Radio\
**Created:** [June 15, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/re-illegal-custombuild-for-msvc-18/242323 "2015-06-15T20:21:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![musicdenotation](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/ea666f/32.png) [@musicdenotation](https://www.ruby-forum.com/u/musicdenotation)\
**Post date:** [June 15, 2015, 8:21pm UTC](https://www.ruby-forum.com/t/re-illegal-custombuild-for-msvc-18/242323/1 "2015-06-15T20:21:35Z")

</div>

I’ve also been struggling with the gnu-radio build in Windows (GNURadio  
3.7.7.1, CMake 3.2.2, VisualStudio 12.0.31101.00 Update 4), and had the  
same problem. The illegal “” commands seem to be coming from the custom  
build steps for the “.rule” files in the projects starting with a “\_”  
(e.g. \_pmt\_swig). In each of these projects there is a “CMAKE Rules” dir  
with “.rule” files that have “” in their custom build script.  
I’ve found the learning curve for this build to be incredibly steep, I  
also have no real understanding of the gnu-radio build process or the  
authoring of CMake projects, but I managed to track this problem to the  
following stanza in \cmake\Modules\UseSWIG.cmake  
foreach(swig\_gen\_file ${${outfiles}})  
add\_custom\_command(  
OUTPUT ${swig\_gen\_file}  
COMMAND “”  
DEPENDS ${\_target}  
COMMENT “”  
)  
endforeach()

It seems that if you put something in the COMMAND “” quotes it is passed  
into the custom build script without the quotes, but if you just put a  
pair of empty double quoates as above, you get the double quotes in the  
custom-build step and Visual Studio throws up the error. Removing or  
commenting-out the COMMAND “” line above (then doing a CMake configure  
and generate) seems to solve the problem.  
I don’t know enough about CMake to know whether this is a bug in CMake  
or a mistake in the GNURadio UseSWIG.cmake file, but I checked the  
latest commit in the gnu-radio repo and the COMMAND “” line is stil in  
the “UseSWIG.cmake” file. I also couldn’t find an open bug report about  
this so I raised it as bug #799.  
CE.

* * *

I encountered the same problem. No idea how to properly fix it, For  
now, I just did a global replace in \*.vcxproj for “” to nothing. That  
worked and I was able to build everything.

* * *

Eugene Grayver, Ph.D.  
Aerospace Corp., Sr. Eng. Spec.  
Tel: 310.336.1274

* * *

From: address@hidden  
To: address@hidden,  
Date: 03/31/2015 09:01 AM  
Subject: Discuss-gnuradio Digest, Vol 148, Issue 34  
Sent by: address@hidden

* * *

From: Gisle V.  
Subject: [Discuss-gnuradio] Illegal CustomBuild for MSVC 18  
Date: Tue, 31 Mar 2015 12:37:03 +0200  
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:36.0) Gecko/20100101  
Firefox/36.0 SeaMonkey/2.33.1  
I have had some more success building Gr using MSVC v18  
than MSVC v16 previously (nearly impossible). Besides the  
high noise-level (due to cmake/msvc/config.h), the C++ building  
seems fine.  
But the build stops in ‘build\gnuradio-runtime\swig’  
at some CustomBuild/CustomCommand. Here is from the MSbuild  
output:  
if %errorlevel% neq 0 goto :cmEnd  
:cmEnd  
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone  
:cmErrorLevel  
exit /b %1  
:cmDone  
if %errorlevel% neq 0 goto :VCEnd  
setlocal  
“” \<\< !! because of this  
if %errorlevel% neq 0 goto :cmEnd  
:cmEnd  
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone  
:cmErrorLevel  
exit /b %1  
:cmDone  
if %errorlevel% neq 0 goto :VCEnd  
setlocal  
“”  
if %errorlevel% neq 0 goto :cmEnd  
:cmEnd  
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone  
:cmErrorLevel  
exit /b %1  
:cmDone  
if %errorlevel% neq 0 goto :VCEnd  
Building Custom Rule  
F:/gv/dx-radio/gnuradio-3.x/gnuradio-runtime/swig/CMakeLists.txt  
‘""’ is not recognized as an internal or external command,

What command in ‘gnuradio-runtime\swig\CMakeLists.txt’ could trigger  
this  
illegal CMD batch snippet?  
BTW. I generated the .sln/.vcxproj files by a script:  
setlocal  
cd build  
set OPT=-DCMAKE\_CXX\_COMPILER=cl -DCMAKE\_C\_COMPILER=cl ^  
-DCMAKE\_CXX\_COMPILER\_ENV\_VAR=-nologo -O2 -MD ^  
-DCMAKE\_C\_COMPILER\_ENV\_VAR=-nologo -O2 -MD ^  
-Wno-dev -DCMAKE\_BUILD\_TYPE=“Release” -DENABLE\_TESTING=1 ^

-DPORTAUDIO\_LIBRARIES=%MINGW32%/src/Sound/Portaudio/lib/portaudio\_static\_x86.lib  
cmake %OPT% -G “Visual Studio 12 2013” …  
…
