<br><br><div class="gmail_quote"><br>If I use Visual Studio 2005 generator everything works well.<br><br>But, it seems that Visual Studio 2005 does not require the input file ( in this case foo.txt.rule ) to Custom Build Step to exist on disk. So the Visual Studio 2005 generator never makes foo.txt.rule to the disk, but the whole thing still works. <br>
<br>While in Visual Studio 2010 it seems that the input file to custom build step must exist on disk. <br><br>I tested this with defining Custom Build Steps directly through The Visual Studio 2005 and Visual studio 2010 IDE.<br>
<br>So , someone can say is this a bug in the Visual Studio 2010 generator?<br> <br>thank you<div><div></div><div class="h5"><br><br><br><div class="gmail_quote">On Wed, Mar 31, 2010 at 2:09 PM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">CC-ing back to the mailing list...<br>
<br>
Sorry, I don't know why this fails and I don't have VS-2010 around. What happens if you use a different generator?<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div><br>
On 31. Mar, 2010, at 14:05 , elizabeta petreska wrote:<br>
<br>
> Hello<br>
><br>
> Thank you for the reply.<br>
> I test your suggestion.<br>
> It still generates foo.txt every time I build the solution.<br>
><br>
> I think that this behavior is because foo.txt.rule file is not generated i.e<br>
> doesnot exist on disk. Here is the relevant part in the generated .vcxproj<br>
> project file :<br>
><br>
><br>
> <CustomBuild Include="$(Configuration)\Foo.txt.rule"> // Foo.txt.rule<br>
> doesnot exist<br>
><br>
> <Message<br>
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Generating<br>
> $(Configuration)/Foo.txt</Message><br>
><br>
> <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo<br>
> Foo &gt; C:/project2/build_cmake_vs10/$(Configuration)/Foo.txt</Command><br>
><br>
> <AdditionalInputs<br>
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:project2/build_cmake_vs10/$(Configuration)/Foo.txt.rule;C:project2\myfile.txt;%(AdditionalInputs)</AdditionalInputs><br>
><br>
> <Outputs<br>
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\project2\build_cmake_vs10\$(Configuration)\Foo.txt;%(Outputs)</Outputs><br>
><br>
><br>
> If I change the add_custom_command to the following then foo.txt.rule is<br>
> made by cmake, and it works :<br>
><br>
> set(outfile "Foo.txt")<br>
> add_custom_command(OUTPUT "${outfile}"<br>
> COMMAND echo Foo > "${outfile}"<br>
> DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt"<br>
> )<br>
> add_custom_target(Foo DEPENDS "${outfile}")<br>
><br>
> In this case it works because foo.txt.rule is made by cmake on disk in the<br>
> folder ${CMAKE_CURRENT_BINARY_DIR} i.e C:\project2\build_cmake_vs10<br>
><br>
> Someone can say what is the difference if I use CMAKE_CFG_INTDIR in the<br>
> outputs of add_custom_command.<br>
><br>
> Thanks<br>
><br>
><br>
><br>
><br>
><br>
><br>
> On Wed, Mar 31, 2010 at 1:27 PM, Michael Wild <<a href="mailto:themiwi@gmail.com" target="_blank">themiwi@gmail.com</a>> wrote:<br>
><br>
>><br>
>> On 31. Mar, 2010, at 12:07 , elizabeta petreska wrote:<br>
>><br>
>>> Hello<br>
>>><br>
>>> I am using cmake 2.8 to generate Visual Studio 2010 solution files.<br>
>>><br>
>>> I have the following cmakelists.txt :<br>
>>><br>
>>> set(PROJECT_NAME Test2)<br>
>>> PROJECT(${PROJECT_NAME})<br>
>>><br>
>>> FILE(GLOB Test_SRCS<br>
>>> main.cpp<br>
>>> )<br>
>>><br>
>>><br>
>>> ADD_EXECUTABLE(${PROJECT_NAME}<br>
>>> ${Test_SRCS}<br>
>>> )<br>
>>><br>
>>><br>
>>> ADD_CUSTOM_COMMAND (OUTPUT "$(ConfigurationName)/Foo.txt"<br>
>>> COMMAND echo Foo > "$(ConfigurationName)/Foo.txt"<br>
>>> DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt<br>
>>> )<br>
>>> ADD_CUSTOM_TARGET (Foo DEPENDS "$(ConfigurationName)/Foo.txt")<br>
>>> ADD_DEPENDENCIES(${PROJECT_NAME} Foo)<br>
>>><br>
>>> The problem is that Foo.txt is generated on every build on the solution<br>
>>> although myfile.txt is not changed.<br>
>><br>
>> Use absolute paths in the OUTPUT and DEPENDS options. And you should also<br>
>> use the CMAKE_CFG_INTDIR variable instead of $(ConfigurationName)...<br>
>><br>
>> set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Foo.txt")<br>
>> add_custom_command(OUTPUT "${outfile}"<br>
>> COMMAND echo Foo > "${outfile}"<br>
>> DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt"<br>
>> )<br>
>> add_custom_target(Foo DEPENDS "${outfile}")<br>
>><br>
>><br>
>> HTH<br>
>><br>
>> Michael<br>
<br>
</div></div></blockquote></div><br>
</div></div></div><br>