<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body><div style="font-family:Arial;">Hi Florent,<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">thank you so much. EXCLUDE_FROM_ALL does indeed have the effect of ignoring any install() invocations from within the subdirectory. I remember stumbling across this option, but from the docs I didn't get the impression that this would affect the installation as well.<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Maybe the documentation needs a few more words here.<br></div>
<div style="font-family:Arial;"><br></div>
<blockquote type="cite"><div><div><div style="font-family:Arial;"><br></div>
</div>
<div>Also, 3rdparty libraries should be tagged like that anyway to be built only when they are used by the main targets. <br></div>
</div>
</blockquote><div style="font-family:Arial;">Yes, this is a good idea.<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;">Thanks again,<br></div>
<div style="font-family:Arial;">Milan<br></div>
<div style="font-family:Arial;"><br></div>
<div style="font-family:Arial;"><br></div>
<div id="sig23146625"><div class="signature">--<br></div>
<div class="signature">  Milan Ziegler<br></div>
<div class="signature">  milan@fastmail.com<br></div>
<div class="signature"><br></div>
</div>
<div><br></div>
<div><br></div>
<div>On Thu, Feb 16, 2017, at 13:33, Florent Castelli wrote:<br></div>
<blockquote type="cite"><div><div style="font-family:Arial;">Use add_subdirectory(...  EXCLUDE_FROM_ALL) to prevent anything in there to be installed by default. <br></div>
<div>I had the issue in one project and it did fix it for us. <br></div>
<div><br></div>
<div>Also, 3rdparty libraries should be tagged like that anyway to be built only when they are used by the main targets. <br></div>
<div><br></div>
<div>/Florent <br></div>
</div>
<div><div style="font-family:Arial;"><br></div>
<div defang_data-gmailquote="yes"><div style="font-family:Arial;">On Feb 16, 2017 07:59, "Milan Ziegler" <<a href="mailto:milan@fastmail.com">milan@fastmail.com</a>> wrote:<br></div>
<blockquote defang_data-gmailquote="yes" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204, 204, 204);padding-left:1ex;"><div style="font-family:Arial;">Hi,<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> we are using the CMake install mechanism "install(...)" to copy all<br></div>
<div style="font-family:Arial;"> relevant files and target binaries of the product into the CMake install<br></div>
<div style="font-family:Arial;"> prefix folder, for further packaging. So far so good.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> We are also using several thirdparty libraries, hosting them inside our<br></div>
<div style="font-family:Arial;"> own repository and building them along with our own code, usually using<br></div>
<div style="font-family:Arial;"> add_subdirectory utilizing their native CMake buildsystem.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Turns out, other developers also like the CMake install mechanism.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> So now the INSTALL target of our whole project also installs thirdparty<br></div>
<div style="font-family:Arial;"> components, which we do not want to deliver with our own product (think<br></div>
<div style="font-family:Arial;"> static libraries, which are already linked into our executable).<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> After a lot of googling, here's my question: Is there a clean way to<br></div>
<div style="font-family:Arial;"> disable the install target for a subdirectory _without_ also disabling<br></div>
<div style="font-family:Arial;"> it completely for the remaining project?<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> What we already tried:<br></div>
<div style="font-family:Arial;"> * Setting CMAKE_INSTALL_PREFIX to a temporary directory for the<br></div>
<div style="font-family:Arial;"> subdirectory (doesn't work)<br></div>
<div style="font-family:Arial;"> * "function(install) endfunction()" to disable the install function for<br></div>
<div style="font-family:Arial;"> the subdirectory (breaks CMake in hilarious ways)<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> What we now do:<br></div>
<div style="font-family:Arial;"> Using a custom target, we patch the cmake_install.cmake files in the<br></div>
<div style="font-family:Arial;"> build directories before installing (works, but it's an  abomination of<br></div>
<div style="font-family:Arial;"> a hack)<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Any help? I think it's a valid usecase for CMake but there doesn't seem<br></div>
<div style="font-family:Arial;"> to be an easy way to do it.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> We are using CMake 3.5.<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Thank you :)<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> --<br></div>
<div style="font-family:Arial;">   Milan<br></div>
<div style="font-family:Arial;">   <a href="mailto:milan@fastmail.com">milan@fastmail.com</a><br></div>
<div style="font-family:Arial;"> --<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Powered by <a href="http://www.kitware.com">www.kitware.com</a><br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> 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/<wbr>CMake_FAQ</a><br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> CMake Support: <a href="http://cmake.org/cmake/help/support.html">http://cmake.org/cmake/help/<wbr>support.html</a><br></div>
<div style="font-family:Arial;"> CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html">http://cmake.org/cmake/help/<wbr>consulting.html</a><br></div>
<div style="font-family:Arial;"> CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html">http://cmake.org/cmake/help/<wbr>training.html</a><br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/<wbr>opensource/opensource.html</a><br></div>
<div style="font-family:Arial;"> <br></div>
<div style="font-family:Arial;"> Follow this link to subscribe/unsubscribe:<br></div>
<div style="font-family:Arial;"> <a href="http://public.kitware.com/mailman/listinfo/cmake">http://public.kitware.com/<wbr>mailman/listinfo/cmake</a><br></div>
</blockquote></div>
</div>
</blockquote><div style="font-family:Arial;"><br></div>
</body>
</html>