[CMake] building a library named 'general'

Matthew Woehlke matthew.woehlke at kitware.com
Tue Nov 19 19:21:22 EST 2013


On 2013-11-19 19:07, Michael DiCuccio wrote:
> Suppose you have a library named general:
>
> -----
> add_library(general foo bar)
> -----
>
> ....and then try to link it into an application:
> -----
> add_executable(myapp baz)
> target_link_libraries(myapp general)
> -----
>
> cmake complains about the fact that 'general' is a reserved keyword, and I
> have found no way to force or finagle linkage against a library named
> 'libgeneral'.

Name the target something else (e.g. 'libgeneral') and modify its 
OUTPUT_NAME? (See set_target_properties and the OUTPUT_NAME property.)

If all you need is to produce a 'libgeneral.so', that may suffice. If 
you also need the target name to be 'general'...

-- 
Matthew



More information about the CMake mailing list