[CMake] Error in generated .vfproj file
Hansom Bear
turbulent1975 at gmail.com
Mon Dec 3 02:32:03 EST 2012
Hi,
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.
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":
program main
implicit none
write(*, *) 'hello, world!'
end program main
And CMake file "D:\foo\m4\CMakeLists.txt":
cmake_mininum_required(VERSION 2.8)
project(hello Fortran)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/hello.f90
COMMAND m4 ${CMAKE_CURRENT_SOURCE_DIR}/sub/hello.m4 >
${CMAKE_CURRENT_BINARY_DIR}/hello.f90
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/sub/hello.m4
)
add_executable(hello hello.f90)
I build the project in directory "D:\foo\build-vs":
cmake ..\m4
CMake generates the files for Visual Studio. But when built in Visual
Studio, it prompts:
>Generating hello.f90
>系统找不到指定的批处理标签 - VCEnd
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:
<Tool Name="VFCustomBuildTool" CommandLine="setlocal
m4 D:/foo/m4/sub/hello.m4 > D:/foo/build-vs/hello.f90
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd" Description="Generating hello.f90"
Outputs="D:\foo\build-vs\hello.f90"
AdditionalDependencies="D:\foo\m4\sub\hello.m4;"/>
So I try to add
:VCEnd
endlocal
at the end of CommandLine string. Then building in Visual Studio again, it
prompts:
>Generating hello.f90
>Project : error PRJ0019: A tool returned an error code from "Generating
hello.f90"
It seems something still wrong in the "hello.vfproj", although the file
"D:/foo/build-vs/hello.f90" is correctly generated.
Is is a bug in CMake, or am I missing anything? Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121203/c6dc8cc8/attachment.htm>
More information about the CMake
mailing list