On 23.10.10 14:01:04, Bastian Moldenhauer wrote:
> I think I found a bug in cmake, but since I am a bloody beginner with cmake
> don't hit me when I am wrong.
Either you're wrong or your posted sample is :)
> If I add a library using add_library(.) and the name of the lib contains a
> dot cmake will produce some wrong dependencies or use a wrong lib output
> name.
>
> How to reproduce:
>
> 1. Create a folder "b"
>
> 2. Put a file "b.c" in "b"
>
> 3. Create a cmakelist with this content in "b"
>
> FILE(GLOB src "*.c")
>
> ADD_LIBRARY(b ${src})
Note that this line above creates a target called 'b' which will build a
library called "b.lib".
> 4. Create a folder "e"
>
> 5. Put a file "e.c" in "e"
>
> 6. Create a cmakelist with this content in "e"
>
> FILE(GLOB src "*.c")
>
> ADD_EXECUTABLE(e ${src})
>
> TARGET_LINK_LIBRARIES(e b.b)
This tries to link the target e against a target named 'b.b'. But this
target doesn't exist. Hence cmake assumes this is the name of a library
provided outside of the project and append ".lib" to it.
> 7. In the parentfolder of "e" and "b" place a cmaklist with this
> content
>
> cmake_minimum_required(VERSION 2.8)
>
> project(Prj)
>
> add_subdirectory(b)
>
> add_subdirectory(e)
>
>
>
> Result:
>
> If you do the above and let cmake create the project files (vs2010 and
> vs2008 in my case) cmake will create a solution that want work. The reason
> is pretty simple. The executable will be dependent on a lib called b.b.lib
> which is correct. But the lib will never be created because project b.b will
> create a lib which is named "b.lib".
If you want to create a library called 'b.b' you should pass that as
target name to add_library. At least on unix this creates a correct
dependency.
Andreas
--
You will be audited by the Internal Revenue Service.
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake