<div dir="ltr">On Fri, Jul 18, 2008 at 9:37 AM, Carminati Federico <Federico.Carminati@cern.ch> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hello,<br>
I want to be able to build optionally static libs for my project. I have no problem to add custom targets and dependencies, this all works nicely. However I want to be able to install them if needed. So I define an installation rule and I label it as optional, as these files may or may not exist. cmake complains with the following message<br>
<br>
WARNING: Target "TTherminator_a" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.<br>
<br>
I believe that this warning is justified if I do not lable the component as OPTIONAL, however if it is labelled as optional, the behaviour IS welll defined. The component is not there and it will not be installed. So I believe that in case of optional install targets the warning should not be there. BEst,</blockquote>
<div><br>Is this not good enough for your needs? We do something very similar at work although we wrap all of the calls to ADD_LIBRARY and INSTALL with macros.<br><br>ADD_LIBRARY(foo-shared SHARED foo.cc)<br>IF(BUILD_STATIC)<br>
ADD_LIBRARY(foo-static STATIC foo.cc)<br>ENDIF()<br><br>INSTALL(TARGETS foo-shared<br>
ARCHIVE DESTINATION lib<br>
LIBRARY DESTINATION lib<br>
RUNTIME DESTINATION bin)<br>
IF(BUILD_STATIC)<br> INSTALL(TARGETS foo-static<br> ARCHIVE DESTINATION lib<br> LIBRARY DESTINATION lib<br> RUNTIME DESTINATION bin)<br>ENDIF()<br></div></div><br clear="all"><br>-- <br>Philip Lowman
</div>