[CMake] libfoo.dll foo.exe liblib collision problem

Brandon J. Van Every bvanevery at gmail.com
Tue Dec 13 11:49:22 EST 2005


William A. Hoffman wrote:

>
>The way I fixed it was to make the name of the library a variable.
>  
>
I decided to go the other way and use
ADD_LIBRARY(libfoo ${FOO_LIB_SOURCES})
SET_TARGET_PROPERTIES(libfoo PROPERTIES PREFIX "")
It's simpler, more readable.  It generates libfoo.dll, which is what I want.

Unfortunately, now foo.exe is behaving stupidly.  It doesn't respect the 
PREFIX modification when looking for a make target.
TARGET_LINK_LIBRARIES(foo libfoo)
make[2]: *** No rule to make target `liblibfoo.dll', needed by 
`foo.exe'.  Stop.

So the general problem is that neither PREFIX or OUTPUT is being 
respected for make targets.

>
>However, changing the output name should work and is really just a bug in CMake.
>Please make a bug report www.cmake.org/Bug.
>  
>
In the course of rewriting, I have discovered that the following lines 
alone will cause problems:
ADD_EXECUTABLE(foo ${FOO_EXE_SOURCES})
SET_TARGET_PROPERTIES(foo PROPERTIES OUTPUT_NAME foo)
Somehow, setting an output name to what it should be anyways will 
destroy the ability of other make targets to deduce the correct 
dependency.  So, the bug appears to be simpler and more specific than I 
had imagined before.  That said, I don't feel I've created a perfect 
reproducer yet, which I feel is needed for a bug report.


Cheers,
Brandon Van Every
RTFM ISA PITA



More information about the CMake mailing list