<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
        {mso-style-priority:34;
        margin-top:0cm;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:36.0pt;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Courier New";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:32728552;
        mso-list-type:hybrid;
        mso-list-template-ids:-603316516 -261204952 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:20.4pt;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:56.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:92.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:128.4pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:164.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:200.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:236.4pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:272.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:308.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1
        {mso-list-id:284846404;
        mso-list-type:hybrid;
        mso-list-template-ids:-1371371568 -1250787784 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l1:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:32.4pt;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:68.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:104.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:140.4pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:176.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:212.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:248.4pt;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:284.4pt;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        margin-left:320.4pt;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2
        {mso-list-id:1002469126;
        mso-list-type:hybrid;
        mso-list-template-ids:872970356 1265272160 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l2:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l2:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l2:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l2:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l2:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l2:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l3
        {mso-list-id:1220164481;
        mso-list-type:hybrid;
        mso-list-template-ids:-731058696 -880611848 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l3:level1
        {mso-level-start-at:0;
        mso-level-number-format:bullet;
        mso-level-text:-;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-font-family:Calibri;
        mso-bidi-font-family:"Times New Roman";}
@list l3:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l3:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l3:level5
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
@list l3:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Symbol;}
@list l3:level8
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:"Courier New";}
@list l3:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:none;
        mso-level-number-position:left;
        text-indent:-18.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0cm;}
ul
        {margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>I have a projects in which the sources file are organizes in a hierarchy of directories.<o:p></o:p></p><p class=MsoNormal>For example:<o:p></o:p></p><p class=MsoNormal>- Src<o:p></o:p></p><p class=MsoNormal>| - Folder A<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp; | - 1.cpp<o:p></o:p></p><p class=MsoNormal>&nbsp; &nbsp;| - 1.hpp<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp; | - FolderA1<o:p></o:p></p><p class=MsoNormal>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;| - 2.cpp<o:p></o:p></p><p class=MsoNormal>&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;| - 2.hpp<o:p></o:p></p><p class=MsoNormal>| - Folder B<o:p></o:p></p><p class=MsoNormal>&nbsp;&nbsp; | - 3.cpp<o:p></o:p></p><p class=MsoNormal>&nbsp; &nbsp;| - 3.hpp<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>I wrote a CMakeLists.txt for generating a Visual Studio Projects (VS 2012).<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>My goals are the following:<o:p></o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l3 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Preserve the directory structure<o:p></o:p></p><p class=MsoListParagraph style='text-indent:-18.0pt;mso-list:l3 level1 lfo1'><![if !supportLists]><span style='mso-list:Ignore'>-<span style='font:7.0pt "Times New Roman"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></span><![endif]>Allows other developer to add source files in the directory, by means of visual studio, without having to write CMakeLists.txt<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>For doing that I wrote the following CMakeLists.txt<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:blue'>cmake_minimum_required</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>(</span><span style='font-size:10.0pt;font-family:Consolas;color:blue'>VERSION</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>&nbsp;2.8.11)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:blue'>project</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>(Common-library&nbsp;CXX)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:black'> <o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:green'>#set&nbsp;the&nbsp;default&nbsp;path&nbsp;for&nbsp;built&nbsp;executables&nbsp;to&nbsp;the&nbsp;&quot;bin&quot;&nbsp;directory</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:blue'>set</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>(EXECUTABLE_OUTPUT_PATH&nbsp;${PROJECT_SOURCE_DIR}/bin)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:green'>#set&nbsp;the&nbsp;default&nbsp;path&nbsp;for&nbsp;built&nbsp;libraries&nbsp;to&nbsp;the&nbsp;&quot;lib&quot;&nbsp;directory</span><span style='font-size:10.0pt;font-family:Consolas;color:black'><o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt;background:white'><span style='font-size:10.0pt;font-family:Consolas;color:blue'>set</span><span style='font-size:10.0pt;font-family:Consolas;color:black'>(LIBRARY_OUTPUT_PATH&nbsp;${PROJECT_SOURCE_DIR}/lib)<o:p></o:p></span></p><p class=MsoNormal style='margin-left:36.0pt'><o:p>&nbsp;</o:p></p><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'>#Specify&nbsp;my&nbsp;Include&nbsp;Directory</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>set</span><span style='font-family:Consolas;color:black'>(PROJECT_INCLUDE_DIR&nbsp;${PROJECT_SOURCE_DIR}/src)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'> <o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'>#&nbsp;Boost&nbsp;configuration</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>SET</span><span style='font-family:Consolas;color:black'>(Boost_USE_STATIC_LIBS&nbsp;ON)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>find_package</span><span style='font-family:Consolas;color:black'>(Boost&nbsp;</span><span style='font-family:Consolas;color:blue'>REQUIRED</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:blue'>COMPONENTS</span><span style='font-family:Consolas;color:black'>&nbsp;filesystem&nbsp;system&nbsp;thread&nbsp;</span><span style='font-family:Consolas;color:blue'>REQUIRED</span><span style='font-family:Consolas;color:black'>)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>include_directories</span><span style='font-family:Consolas;color:black'>(&nbsp;${Boost_INCLUDE_DIRS}&nbsp;${ PROJECT_INCLUDE_DIR}&nbsp;)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'>#&nbsp;I used this for allowing CMake to include all the files,<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'># also new ones, without having to touch the CMakeLists.txt</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>file</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:blue'>GLOB_RECURSE</span><span style='font-family:Consolas;color:black'>&nbsp;PROJECT_SOURCE_FILES&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;*.h&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;*.hpp&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;*.cpp&quot;</span><span style='font-family:Consolas;color:black'>)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'>#&nbsp;I then wrote this Macro, which organize the files in visual studio folders,<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'># according to the organization in the file systems<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'><o:p>&nbsp;</o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>macro</span><span style='font-family:Consolas;color:black'>(GroupSources&nbsp;curdir)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;</span><span style='font-family:Consolas;color:blue'>file</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:blue'>GLOB</span><span style='font-family:Consolas;color:black'>&nbsp;children&nbsp;</span><span style='font-family:Consolas;color:blue'>RELATIVE</span><span style='font-family:Consolas;color:black'>&nbsp;${PROJECT_SOURCE_DIR}/${curdir}&nbsp;${PROJECT_SOURCE_DIR}/${curdir}/*)</span><span style='font-family:Consolas;color:blue'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;</span><span style='font-family:Consolas;color:blue'>foreach</span><span style='font-family:Consolas;color:black'>(child&nbsp;${children})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:blue'>if</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:blue'>IS_DIRECTORY</span><span style='font-family:Consolas;color:black'>&nbsp;${PROJECT_SOURCE_DIR}/${curdir}/${child})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GroupSources(${curdir}/${child})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:blue'>else</span><span style='font-family:Consolas;color:black'>()<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:blue'>string</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:blue'>REPLACE</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;/&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;\\&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;groupname&nbsp;${curdir})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:green'>#&nbsp;I would like to call the src root folder in a different name, only in visual studio (not mandatory requirement)</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:blue'>string</span><span style='font-family:Consolas;color:black'>(</span><span style='font-family:Consolas;color:blue'>REPLACE</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;src&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;</span><span style='font-family:Consolas;color:#A31515'>&quot;Common&quot;</span><span style='font-family:Consolas;color:black'>&nbsp;groupname&nbsp;${groupname})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; </span><span style='font-family:Consolas;color:blue'>source_group</span><span style='font-family:Consolas;color:black'>(${groupname}&nbsp;</span><span style='font-family:Consolas;color:blue'>FILES</span><span style='font-family:Consolas;color:black'>&nbsp;${PROJECT_SOURCE_DIR}/${curdir}/${child})<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style='font-family:Consolas;color:blue'>endif</span><span style='font-family:Consolas;color:black'>()<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;</span><span style='font-family:Consolas;color:blue'>endforeach</span><span style='font-family:Consolas;color:black'>()<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>endmacro</span><span style='font-family:Consolas;color:black'>()<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>&nbsp;&nbsp;&nbsp;<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:green'>#&nbsp;Execute&nbsp;the&nbsp;macro</span><span style='font-family:Consolas;color:black'><o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'>GroupSources(src)<o:p></o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></pre><pre style='margin-left:36.0pt;background:white'><span style='font-family:Consolas;color:blue'>add_library</span><span style='font-family:Consolas;color:black'>(${PROJECT_NAME}&nbsp;${ PROJECT_SOURCE_FILES})<o:p></o:p></span></pre><pre style='background:white'><span style='font-family:Consolas;color:black'><o:p>&nbsp;</o:p></span></pre><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>The result is a Visual studio project which organizes the files as I desired.<o:p></o:p></p><p class=MsoNormal>However when I try to create new files with visual studio they are not stored in the folder I select, but in the out-of-source build folder.<o:p></o:p></p><p class=MsoNormal>I guess this is due to the fact that visual studio doesn&#8217;t now the mapping between src folder and source group.<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>How can I achieve both my goals?<o:p></o:p></p><p class=MsoNormal><o:p>&nbsp;</o:p></p><p class=MsoNormal>Thanks in advace!<o:p></o:p></p></div></body></html>