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.
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. 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 Librarian -> General-> Additional Dependencies. 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. I have tried following approaches in different ways in MMLib's CMAKE files and none of them seem to be working for me. ---------------------------------------------------------------------------------------------------------------------------------------------- link_directories (Path_To_MM3PLib1) set_target_properties( MMLib PROPERTIES LINK_FLAGS "/LIBPATH:Path_To_MM3PLib1" ) set_target_properties( MMLib PROPERTIES IMPORTED_LOCATION (Path_To_MM3PLib1) ) add_library (MMLib STATIC Path_To_MM3PLib1/MM3PLib1.lib) add_library(MMLib Path_To_MM3PLib2/MM3PLib2.lib) target_link_libraries (MMLib MM3PLib1) target_link_libraries (MMLib MM3PLib2) target_link_libraries (MMLib MM3PLib1.lib) target_link_libraries (MMLib MM3PLib2.lib) ----------------------------------------------------------------------------------------------------------------------------------------------- Thanks, -Shobhit
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake