[CMake] Standard template for building and installing a library

Littlefield, Tyler tyler at tysdomain.com
Tue Sep 10 19:12:28 EDT 2013


On 9/10/2013 6:43 PM, Matthew Woehlke wrote:
> On 2013-09-10 17:38, Littlefield, Tyler wrote:
>> First, I can create a demo directory and from there I can have a
>> cmakelists.txt per demo. Is there a way somehow to link to the generated
>> static library?
>
> Sounds like you are looking for 'target_link_libraries'?
>
>> If I move the CXXFLAGS_DEBUG/etc to a higher level file, is there a way
>> to insure that it promotes down?
>
> I'm not sure there is such a thing as a non-inheriting variable in 
> CMake :-). There are global properties, but they're, well, global...
>
> IOW, anything (scoped) you set in one scope is visible to all 'child' 
> scopes, be they directories, functions, etc. So you don't need to do 
> anything; it will happen automatically.
>
>> My final question is how to make the debug/release build work, as well
>> as to allow to let this install. I need to install libxlog.a and the
>> include directory
>> as well to includedir/xlog/*. Is there a typical method to do this?
>
> See the 'install' command.
>
Awesome, thanks. I've found that actually, I should have been more 
specific. I need to figure out which directory the user wants them 
installed in. Is there a standard method for pulling that information?
Thanks,

-- 
Take care,
Ty
http://tds-solutions.net
He that will not reason is a bigot; he that cannot reason is a fool; he that dares not reason is a slave.



More information about the CMake mailing list