Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>For setting custom project setting in Visual Studio from CMake you can use a XML file as a template which can be configured from CMake to work as the <code>.user</code> file.<br> At my work we use this to set custom debug parameters.</p> <p>Check the directory containing the generated <code>.vcproj</code> files for the user settings in the <code>.user</code> files. Here is a snippet of an example <code>UserTemplate.vcproj</code> file we use.</p> <pre><code>&lt;?xml version="1.0" encoding="Windows-1252"?&gt; &lt;VisualStudioUserFile ProjectType="Visual C++" Version="9.00" ShowAllFiles="false" &gt; &lt;Configurations&gt; &lt;Configuration Name="Debug|@USERFILE_PLATFORM@" &gt; &lt;DebugSettings Command="@USERFILE_COMMAND_DEBUG@" WorkingDirectory="@USERFILE_WORKING_DIRECTORY_DEBUG@" CommandArguments="@USERFILE_COMMAND_ARGUMENTS_DEBUG@" Attach="false" DebuggerType="3" Remote="1" RemoteMachine="@USERFILE_REMOTE_MACHINE_DEBUG@" &lt;!-- More settings removed for snippet --&gt; /&gt; &lt;/Configuration&gt; &lt;!-- Rest of Configurations --&gt; </code></pre> <p>This way you can inject any needed variables from CMake into the <code>.user</code> file. In CMake you can set the appropiate CMake variables (and add more in the template file if you need them). Next you can do something like this to configure the file.</p> <pre><code># Find user and system name SET(SYSTEM_NAME $ENV{USERDOMAIN} CACHE STRING SystemName) SET(USER_NAME $ENV{USERNAME} CACHE STRING UserName) # Configure the template file SET(USER_FILE ${_projectName}.vcproj.${SYSTEM_NAME}.${USER_NAME}.user) SET(OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${USER_FILE}) CONFIGURE_FILE(UserTemplate.user ${USER_FILE} @ONLY) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload