View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0010494CMakeCMakepublic2010-03-31 09:362011-04-04 12:00
ReporterElizabeta 
Assigned ToDavid Cole 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product VersionCMake-2-8 
Target VersionCMake 2.8.4Fixed in VersionCMake 2.8.3 
Summary0010494: Can not use ${CMAKE_CFG_INTDIR} as output in add_custom_command of VS 2010 generator
DescriptionI am using Cmake 2.8.1. and VS2010 generator

If I use the following code, the command is executed every time I build my solution, although the input file ( myfile.txt ) is not changed.

set(outfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Foo.txt")

add_custom_command(OUTPUT "${outfile}"
 COMMAND echo Foo > "${outfile}"
 DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/myfile.txt"
 )
add_custom_target(Foo DEPENDS "${outfile}")

I came to conclusion that this is because foo.txt.rule is not generated by cmake on disk.

If I set outfile to the following :

set(outfile "Foo.txt")

then everything works as it should. That is because in this case foo.txt.rule is made by cmake on the disk.

With Visual Studio 2005 generator both examples work as it should, cause VS2005 does not require foo.txt.rule to exist on disk ( actually cmake vs2005 generator does not make such file on disk ).


TagsNo tags attached.
Attached Filestxt file icon cmakelists.txt [^] (495 bytes) 2010-03-31 09:36 [Show Content]

 Relationships

  Notes
(0024257)
David Cole (manager)
2010-12-17 18:21

This appears to be fixed in CMake 2.8.3.

Try using 2.8.3 -- please re-open this issue and attach further details if you still have problems.

One thing I noticed while reproducing this issue is that you do not include the custom target in "ALL" - so something has to depend on the target in order to get the build rules to execute. If nothing depends on it, and nothing explicitly builds the custom target, then your build rules will not execute as part of a "Build Solution" operation in Visual Studio. (Just an FYI...)

I'm guessing you do have something that depends on it, or you simply omitted the ALL when reporting the bug...

Let me know if you need further help, but I think this one is fixed.
(0026075)
David Cole (manager)
2011-04-04 12:00

Closing resolved issues that have not been updated in more than 3 months.

 Issue History
Date Modified Username Field Change
2010-03-31 09:36 Elizabeta New Issue
2010-03-31 09:36 Elizabeta File Added: cmakelists.txt
2010-12-14 16:32 David Cole Status new => assigned
2010-12-14 16:32 David Cole Assigned To => David Cole
2010-12-17 07:41 David Cole Target Version => CMake 2.8.4
2010-12-17 18:21 David Cole Note Added: 0024257
2010-12-17 18:21 David Cole Status assigned => resolved
2010-12-17 18:21 David Cole Fixed in Version => CMake 2.8.3
2010-12-17 18:21 David Cole Resolution open => fixed
2011-04-04 12:00 David Cole Note Added: 0026075
2011-04-04 12:00 David Cole Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team