Hello all!<br /><br />10:00, 16 February 2017 г., Milan Ziegler <milan@fastmail.com>:<br /><blockquote><p>Hi,<br /><br />we are using the CMake install mechanism "install(...)" to copy all<br />relevant files and target binaries of the product into the CMake install<br />prefix folder, for further packaging. So far so good.<br /><br />We are also using several thirdparty libraries, hosting them inside our<br />own repository and building them along with our own code, usually using<br />add_subdirectory utilizing their native CMake buildsystem.<br /><br />Turns out, other developers also like the CMake install mechanism.<br /><br />So now the INSTALL target of our whole project also installs thirdparty<br />components, which we do not want to deliver with our own product (think<br />static libraries, which are already linked into our executable).<br /><br />After a lot of googling, here's my question: Is there a clean way to<br />disable the install target for a subdirectory _without_ also disabling<br />it completely for the remaining project?<br /><br />What we already tried:<br />* Setting CMAKE_INSTALL_PREFIX to a temporary directory for the<br />subdirectory (doesn't work)<br />* "function(install) endfunction()" to disable the install function for<br />the subdirectory (breaks CMake in hilarious ways)<br /><br />What we now do:<br />Using a custom target, we patch the cmake_install.cmake files in the<br />build directories before installing (works, but it's an  abomination of<br />a hack)<br /><br />Any help? I think it's a valid usecase for CMake but there doesn't seem<br />to be an easy way to do it.<br /><br />We are using CMake 3.5.<br /><br /><br />Thank you :)<br /><br /></p><span>-- <br />  Milan<br />  <a href="mailto:milan@fastmail.com">milan@fastmail.com</a><br />-- <br /></span><p><br />Powered by <a href="http://www.kitware.com">www.kitware.com</a><br /><br />Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ">http://www.cmake.org/Wiki/CMake_FAQ</a><br /><br />Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br /><br />CMake Support: <a href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/support.html</a><br />CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/consulting.html</a><br />CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/training.html</a><br /><br />Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br /><br />Follow this link to subscribe/unsubscribe:<br /><a href="http://public.kitware.com/mailman/listinfo/cmake">http://public.kitware.com/mailman/listinfo/cmake</a><br /></p></blockquote>It common actual problem.<div><br /></div><div>My suggestion:</div><div>a) Separate CMakeLists.txt code to several files:</div><div> - CMakeLists.txt;</div><div> - CTestLists.txt;</div><div> - CDashLists.txt;</div><div> - CPackLists.txt;</div><div>b) Add common options to enable/disable feature for directory:</div><div> - CMAKE_LISTS_TXT:BOOL;</div><div><span style="font-family:sans-serif;"> - CTEST_LISTS_TXT:BOOL;</span><br /></div><div><span style="font-family:sans-serif;"> - CDASH_LISTS_TXT:BOOL;</span><span style="font-family:sans-serif;"><br /></span></div><div><span style="font-family:sans-serif;"> - CPACK_LISTS_TXT:BOOL;</span><span style="font-family:sans-serif;"><br /></span></div><div>c) Fix add_subdirectory command implementation :-)</div><div><br /></div><div>--</div><div>Regards,</div><div>Konstantin Podsvirov</div>