I am using cmake 2.8.1. <br>But you are right, Visual studio 2010 is not relased yet. So I guess I can not except everything to works well. I will wait till Visual Studio 2010 is released and maybe some more time after that :) <br>
<br><div class="gmail_quote">On Wed, Mar 31, 2010 at 2:40 PM, Michael Wild <span dir="ltr"><<a href="mailto:themiwi@gmail.com">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;">
Well, VS-2010 isn't even released so far... Which exact version of CMake are you using by the way? 2.8 or 2.8.1? If I remember correctly, there were some improvements in 2.8.1 w.r.t. VS-2010.<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
<br>
On 31. Mar, 2010, at 14:28 , elizabeta petreska wrote:<br>
<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<br>
> this case foo.txt.rule ) to Custom Build Step to exist on disk. So the<br>
> Visual Studio 2005 generator never makes foo.txt.rule to the disk, but the<br>
> whole thing still works.<br>
><br>
> While in Visual Studio 2010 it seems that the input file to custom build<br>
> step must exist on disk.<br>
><br>
> I tested this with defining Custom Build Steps directly through The Visual<br>
> 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<br>
><br>
><br>
> On Wed, Mar 31, 2010 at 2:09 PM, Michael Wild <<a href="mailto:themiwi@gmail.com">themiwi@gmail.com</a>> wrote:<br>
><br>
>> 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<br>
>> happens if you use a different generator?<br>
>><br>
>> Michael<br>
>><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<br>
>> i.e<br>
>>> doesnot exist on disk. Here is the relevant part in the generated<br>
>> .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<br>
>> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">echo<br>
>>> Foo &gt; C:/project2/build_cmake_vs10/$(Configuration)/Foo.txt</Command><br>
>>><br>
>>> <AdditionalInputs<br>
>>><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>
>>><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<br>
>> 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">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<br>
>> 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>
>><br>
<br>
</div></div></blockquote></div><br>