[CMake] Strange behaviour of CMake

Brad King brad.king at kitware.com
Wed Mar 22 09:55:03 EST 2006


Xavier Delannoy wrote:
> 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 have this issue under FreeBSD, Linux, MacOS X (I have not yet tested with Win32)
> 
> in attach you'll find an example of the problem.
> 
> the script build.sh execute CMake in the root directory of the project, then build the project.
> 
> the script build2.sh execute CMake in each library directory then build the project.
> 
> Do I mistake ? or is this a bug ?

You cannot have two targets with the same name in the same project even 
in different directories.  This is a limitation due to Visual Studio and 
Xcode generators because those IDEs can only load workspaces with unique 
project names.

In CVS CMake you can add the two targets with different logical names 
and then use the OUTPUT_NAME target property to give them the same name 
on disk.  As long as they are built into separate output directories it 
should work.  See the documentation of the SET_TARGET_PROPERTIES command.

-Brad


More information about the CMake mailing list