<div dir="ltr"><div class="gmail_default" style="font-size:small;color:rgb(0,0,102)">I am working on creating an SDK from an existing product's code base and use it as an independent static library. The issue I am facing is that the older product, let's say MM, used to link with all the dependencies in the executable but I have to provide one monolith SDK lib that contains all its dependencies within itself. I have struggled but couldn't find the way to achieve that in CMAKE.<br>

<br></div><div class="gmail_default" style="font-size:small;color:rgb(0,0,102)">The structure of the code is such that the MMexe- old product's executable- depends on MMLib but MMLib in turn depends on 3rd party libs, let's say MM3PLib1 and MM3PLib2. In older CMAKE files, MMExe would depend on MM3PLib1 and MM3PLib2 so all dependencies were resolved at link time.<br>

<br></div><div class="gmail_default" style="font-size:small;color:rgb(0,0,102)">But now, we need to create MMLib in such a way that its clients will not have to depend on, or link to, any other 3rd parties. In visual Studio, we can do it by using <span style="font-size:12pt;font-family:"Times New Roman","serif";color:rgb(0,32,96);background:none repeat scroll 0% 0% silver">Librarian -> General-></span><span style="font-size:12pt;font-family:"Times New Roman","serif";background:none repeat scroll 0% 0% silver"> <span style="color:rgb(0,32,96)">Additional Dependencies. </span></span>  This way the generated MMLib contains all its dependencies by archiving them. I have tried multiple approaches but couldn't achieve the same result through CMAKE. Even after setting these values, the corresponding fields in VS are blank.<br>

<br></div><div class="gmail_default" style="font-size:small;color:rgb(0,0,102)">I have tried following approaches in different ways in MMLib's CMAKE files and none of them seem to be working for me.<br><br>----------------------------------------------------------------------------------------------------------------------------------------------<br>

link_directories (Path_To_MM3PLib1)<br><br>set_target_properties( MMLib PROPERTIES LINK_FLAGS "/LIBPATH:Path_To_MM3PLib1" )<br>set_target_properties( MMLib PROPERTIES IMPORTED_LOCATION (Path_To_MM3PLib1) )<br><br>

add_library (MMLib STATIC Path_To_MM3PLib1/MM3PLib1.lib)<br>add_library(MMLib Path_To_MM3PLib2/MM3PLib2.lib)<br><br>target_link_libraries (MMLib MM3PLib1) <br>target_link_libraries (MMLib MM3PLib2)<br>target_link_libraries (MMLib MM3PLib1.lib)<br>

target_link_libraries (MMLib MM3PLib2.lib)<br>-----------------------------------------------------------------------------------------------------------------------------------------------<br><br></div><div class="gmail_default" style="font-size:small;color:rgb(0,0,102)">

Thanks,<br></div><div><span style="color:rgb(0,0,102)">-Shobhit</span><br><br></div>
</div>