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

William A. Hoffman billlist at nycap.rr.com
Tue Dec 13 11:52:43 EST 2005


At 11:49 AM 12/13/2005, Brandon J. Van Every wrote:
>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.

Unfortunately, the only way to get this to work is to make the library name a variable.
I did try all the various PREFIX and OUTPUT options first, and CMake is currently broken
when these things change.

-Bill
  



More information about the CMake mailing list