[CMake] export files and FIND_PACKAGE
Michael Wild
themiwi at gmail.com
Fri Feb 5 03:51:24 EST 2010
On 5. Feb, 2010, at 9:18 , Micha Renner wrote:
> I install a library (TLib) and their export files with these commands:
>
> INSTALL(TARGETS TLib EXPORT TLibX RUNTIME DESTINATION dll
> LIBRARY DESTINATION lib
> ARCHIVE DESTINATION lib)
>
> INSTALL(EXPORT TLibX NAMESPACE mp_ DESTINATION lib/TLib)
> INSTALL(FILES TLib-config.cmake DESTINATION lib/TLib)
>
> To find the library I use:
> FIND_PACKAGE(TLib REQUIRED)
>
> This works.
>
> If I exchange TLibX for TLib (first two install commands) , CMake says
> during executing FIND_PACKAGE:
> "Cannot create mp_TLib target, because target already exists". Then it
> goes in an endless loop calling FIND_PACKAGE again and again
> and crashes sooner or later.
>
> Are their any roles to chose the right export-filenames?
>
> Micha
Hmmm, that appears to be a bug. Anyways, I usually call the EXPORT something like TLibExports or TLibTargets. The name doesn't really matter, since the user will never actually see it.
Michael
More information about the CMake
mailing list