Hello all,<br><br>I&#39;m hopeful that someone can point me in the correct direction to solve a problem I&#39;m having setting up arguments into the resource compiler.<br><br>I am attempting to add a custom rule to a CMakeLists.txt file to allow me to set a specific flag for one file in the SOURCES list.  I&#39;m assuming the correct approach here is to create a custom command and specify the particular flag I want on the command line, but I can&#39;t make it work.<br>
<br>project (cm_BBS)<br>...<br>set (SOURCES ... BBS.rc)<br>...<br>add_custom_command( OUTPUT ${PROJECT_BINARY_DIR}/cm_BBS.res<br>                    DEPENDS BBS.rc<br>                     COMMAND ${CMAKE_RC_COMPILER} ${CMAKE_CXX_FLAGS} -D__USER__=\&quot;$(username)\&quot;<br>
)<br><br><br>to replace the behavior of the generated rule from the SOURCES line.<br>cmake completely ignores this and uses the default rule.<br><br>When I attempt removing the RC file from the SOURCES list, then no rule is generated.  <br>
And I&#39;m unclear on how to add a dependency that is not a top level dependency to the project using add_dependencies.  add_executable takes SOURCES; do these automatically bind to their generated outputs ? If so, that might be the key.  <br>
<br>The only solution other that comes to mind is to move this source file into a separate directory and mod the CXX_FLAGS in isolation, but that&#39;s really a hack and would mess up my perforce merges.<br><br>Can someone tell me the right way to approach this ?  <br>
<br>As a side note, there&#39;s an interesting observation here.  When I check the generated output for the resource compiler, the output file is cm_BBS.res, even though the input file is BBS.rc, so the resource compiler generation seems to be picking up the project name rather than the actual source file name.  ( I tried it both ways in the custom rule; neither worked.)<br>
<br>ALl this is necessary because, I cannot affect the
CMAKE_RC_FLAGS independently from the CMAKE_CXX_FLAGS.  What works for the compiler (wrt quotes) breaks the RC.  Setting CMAKE_RC_FLAGS, which is all I really need to do, has no impact at all on the build; it is ignored.  issue #10119.  Also, note that the generated CmakeCache.txt file labels the CMAKE_RC_FLAGS as a Fortran field, so the generated comment is misplaced.<br>
<br>If anyone can offer me the benefit of their experience here, I&#39;d greatly appreciate it.<br><br>My configuration : generating for VS 2005 from cmake 2.8, generated from the 2.8.0 source distro, with the MIDL quoting patch applied.<br>
<br>cheers<br>/t<br><br>