[CMake] Strange behaviour of CMake

William A. Hoffman billlist at nycap.rr.com
Wed Mar 22 09:51:26 EST 2006


At 05:54 AM 3/22/2006, Xavier Delannoy wrote:
>hi all, 
>
>I have two library, lib2 depends of lib1. Each lib are static and shared. 
>if I execute CMake in lib1 directory then in lib2. The project build correctly, whereas if I execute CMake in the root directory of my project, I obtain this error : "No rule to make target tmp/libn1.a needed by tmp/libn2.dylib" 

I tried you files, and you are doing something that is not supported.
You can not have two targets with the same name.   

This is not allowed in the same project:

ADD_LIBRARY(foo SHARED foo.o)
ADD_LIBRARY(foo STATIC foo.o)


However, what you can do is this:

ADD_LIBRARY(fooShared SHARED foo.o)
SET_TARGET_PROPERTIES(fooShared PROPERTIES OUTPUT_NAME foo)
ADD_LIBRARY(fooStatic STATIC foo.o)
SET_TARGET_PROPERTIES(fooStatic PROPERTIES OUTPUT_NAME foo)

-Bill



More information about the CMake mailing list