[CMake] Warning: Argument not separated from preceding token by whitespace.

Nils Gladitz nilsgladitz at gmail.com
Mon Jun 26 06:50:42 EDT 2017


On Mon, Jun 26, 2017 at 10:33 AM, <ycollette.nospam at free.fr> wrote:

> Hello,
>
> I've got the following code in a cmake file:
>
> 109 add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/tmp-pcode-
> matlab/knitromatlab_fsolve.p
> 110                           ${CMAKE_BINARY_DIR}/tmp-pcode-
> matlab/knitromatlab_lsqnonlin.p
> 111                           ${CMAKE_BINARY_DIR}/tmp-pcode-
> matlab/knitromatlab_mip.p
> 112                    COMMAND ${Matlab_MAIN_PROGRAM} -nodisplay
> -nodesktop -nosplash -r \"run('${CMAKE_BINARY_DIR}/generate_pcode.m')\;\"
> 113                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
> 114                    COMMENT "Generating PCode")
>
>
> When I run cmake, I've got the following warning message:
>
> CMake Warning (dev) in matlab/CMakeLists.txt:
>   Syntax Warning in cmake code at
>
>     /home/jenkins/workspace/Knitro/KnitroLinux/KNITROdir/
> matlab/CMakeLists.txt:112:131
>
>
Try:

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/tmp-pcode-
matlab/knitromatlab_fsolve.p
     ${CMAKE_BINARY_DIR}/tmp-pcode-matlab/knitromatlab_lsqnonlin.p
     ${CMAKE_BINARY_DIR}/tmp-pcode-matlab/knitromatlab_mip.p
     COMMAND ${Matlab_MAIN_PROGRAM} -nodisplay -nodesktop -nosplash -r
"run('${CMAKE_BINARY_DIR}/generate_pcode.m');"
     VERBATIM
     WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
     COMMENT "Generating PCode")

Note the removal of all escape sequences and the addition of VERBATIM.
You don't want literal quotes but rather want to leave platform/generator
specific quoting to CMake.

Nils
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20170626/bafb8903/attachment.html>


More information about the CMake mailing list