[CMake] A small philosophical problem
Bill Hoffman
bill.hoffman at kitware.com
Fri Jul 18 09:48:06 EDT 2008
Carminati Federico 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,
>
It would be more the "cmake way" to use a cmake time option to build or
not build the optional library.
option(BUILD_THERMINATOR " build static TTherminator library")
if(BUILD_THERMINATOR)
add_library(TTherminator_a STATIC ...)
endif(BUILD_THERMINATOR)
-Bill
More information about the CMake
mailing list