In my project there are multiple subdirectories, out of which one is utils, and utils.vcxproj has details like below:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1705D35F-B357-4C31-A45C-D18AD75D9325}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<ImportGroup Label="PropertySheets">
<Import Project="$(SolutionDir)PABuildConfig_StaticLibrary.props" />
</ImportGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemGroup>
<ClCompile Include="case.c" />
<ClCompile Include="checksum.c" />
<ClCompile Include="codeword.c" />
<ClCompile Include="convdate.c" />
<ClCompile Include="dbm_log.c" />
<ClCompile Include="escape.c" />
<ClCompile Include="exparamutil.c" />
<ClCompile Include="filelist.c" />
<ClCompile Include="filelist_win32.cpp" />
<ClCompile Include="file_get.c" />
<ClCompile Include="get_time.c" />
<ClCompile Include="hooklist.c" />
<ClCompile Include="list.c" />
<ClCompile Include="ntharg.c" />
<ClCompile Include="nthline.c" />
<ClCompile Include="search.c" />
<ClCompile Include="set.c" />
<ClCompile Include="stradd.c" />
<ClCompile Include="strlist.c" />
<ClCompile Include="strtrim.c" />
<ClCompile Include="tail.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="convdate.h" />
<ClInclude Include="dbm_log.h" />
<ClInclude Include="filelist.h" />
<ClInclude Include="hooklist.h" />
<ClInclude Include="list.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
Output of compilation is utils.lib
Now I wanted to add one more extra file say cvalidate.c in same subdirectory, but this should not be part of utils.lib and post compile, it should generate cvalidate.exe
I was able to achieve this on Linux platform, where I successfully generated executable cvalidate by adding changes in makefiles, but I am new to Windows concepts of Visual studio .vcxproj file.
So wanted to know what changes should I add in utils.vcxproj file. I added entry like below but it did not served the purpose:
<ClCompile Include="cvalidate.c">
<ExcludedFromBuild>false</ExcludedFromBuild>
</ClCompile>
<Link Include="cvalidate.c">
<SubSystem>Console</SubSystem>
<OutputFile>cvalidate.exe</OutputFile>
<AdditionalDependencies>utils.lib</AdditionalDependencies>
</Link>
You need to create another project (vcxproj) in the same solution (sln). Each project build one binary, you can also specify dependencies between project of the same solution.