Hi,<br><br>I'm trying to use CMake (version 2.8.10) for a Fortran project with Visual Studio 10 and Intel Visual Fortran Composer XE 2011. But the generated .vfproj file seems to have bugs.<br><br>In my project, Fortran source file is generated using m4 and then build into executable. Assume the source directory is "D:\foo\m4". Below is the file (for demo) "D:\foo\m4\sub\hello.m4":<br>
<br>program main<br> implicit none<br> write(*, *) 'hello, world!'<br>end program main<br><br>And CMake file "D:\foo\m4\CMakeLists.txt":<br><br>cmake_mininum_required(VERSION 2.8)<br>project(hello Fortran)<br>
add_custom_command(<br> OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hello.f90<br> COMMAND m4 ${CMAKE_CURRENT_SOURCE_DIR}/sub/hello.m4 > ${CMAKE_CURRENT_BINARY_DIR}/hello.f90<br> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sub/hello.m4<br>
)<br>add_executable(hello hello.f90)<br><br>I build the project in directory "D:\foo\build-vs":<br><br>cmake ..\m4<br><br>CMake generates the files for Visual Studio. But when built in Visual Studio, it prompts:<br>
<br>>Generating hello.f90<br>>系统找不到指定的批处理标签 - VCEnd<br><br>The second line is in Chinese. I don't know the exact English sentence. I think it can be translated into "System cannot find the batch tag - VCEnd". I open hello.vfproj in my editor, and find the snippet below:<br>
<br><Tool Name="VFCustomBuildTool" CommandLine="setlocal<br>m4 D:/foo/m4/sub/hello.m4 &gt; D:/foo/build-vs/hello.f90<br>if %errorlevel% neq 0 goto :cmEnd<br>:cmEnd<br>endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone<br>
:cmErrorLevel<br>exit /b %1<br>:cmDone<br>if %errorlevel% neq 0 goto :VCEnd" Description="Generating hello.f90" Outputs="D:\foo\build-vs\hello.f90" AdditionalDependencies="D:\foo\m4\sub\hello.m4;"/><br>
<br>So I try to add <br><br>:VCEnd<br>endlocal<br><br>at the end of CommandLine string. Then building in Visual Studio again, it prompts:<br><br>>Generating hello.f90<br>>Project : error PRJ0019: A tool returned an error code from "Generating hello.f90"<br>
<br>It seems something still wrong in the "hello.vfproj", although the file "D:/foo/build-vs/hello.f90" is correctly generated.<br><br>Is is a bug in CMake, or am I missing anything? Thanks in advance.<br>
<br>