Philip, Bill,
ok, this is what I did. Adding libarry was already wrapped for me, so it was a two-line change. Thanks,

Federico Carminati
CERN-PH
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 79480
Mobile: +41 76 487 4843

On 18 Jul 2008, at 15:49, Philip Lowman wrote:

On Fri, Jul 18, 2008 at 9:37 AM, Carminati Federico <[EMAIL PROTECTED] > wrote:
Hello,
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

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.

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,

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.

ADD_LIBRARY(foo-shared SHARED foo.cc)
IF(BUILD_STATIC)
   ADD_LIBRARY(foo-static STATIC foo.cc)
ENDIF()

INSTALL(TARGETS foo-shared
   ARCHIVE DESTINATION lib
   LIBRARY DESTINATION lib
   RUNTIME DESTINATION bin)
IF(BUILD_STATIC)
   INSTALL(TARGETS foo-static
      ARCHIVE DESTINATION lib
      LIBRARY DESTINATION lib
      RUNTIME DESTINATION bin)
ENDIF()


--
Philip Lowman

_______________________________________________
CMake mailing list
[email protected]
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to