[CMake] Simclist library produces simclist.c.o, simclist.c.i, simclist.c.s ...
Eric Noulard
eric.noulard at gmail.com
Fri Sep 17 10:50:21 EDT 2010
2010/9/17 SC <robot.conversion at wanadoo.fr>:
> David, Michael,
>
> Thank you for your help. [David, sorry for this double mailing to you]
>
>> > No, this is intentional, I suspect to avoid conflicts. There are people
>> > doing stuff like
>> > add_library(foo foo.c foo.cpp foo.f)
>> > Why is this a problem for you?
> Right, I understand the point of view of the CMake implementation. My problem is that my project statically links
> the .o object file, hence the linker looks explicitly for simclist.o, and since the file doesn't exist anymore, the
> link fails. I understand compiling foo.c and foo.cpp will both generate foo.o, which obviously will conflict. But
> who does this ? This is weird isn't it ? It looks like walking on one's foot to me !
>
> Of course I could alter my project's Makefile so that to reflect to simclist.o -> simclist.c.o change. Doing this
> also means that eventually, in a few years, I might come through the same kind of issue if Cmake generates not
> simclist.c.o but simclist.c.X.o or even simclist.o : I'd need to change my project's makefile again so that I link
> with simclist.c.X.o or simclist.o.
Why are you talking about Makefile?
Common usage of CMake is to avoid writing any Makefile?
With CMake you write CMakeLists.txt and CMake generates the makefiles for you.
Concerning your static link you could build a static lib.
> I'd expect a way to force output file name. What's your opinion ? If you were me, would you go into changing my
> project Makefile ?
Like I said you shouldn't be writing a "Makefile" unless you are
speacking about CMakeLists.txt.
>> Michael's exactly right. We consider the name and location of the object
>> files to be an implementation detail of CMake (and it's different on
>> different systems with different compilers....) -- you cannot rely on those
>> details being exactly the same from version to version of CMake. Especially
>> not versions that are spaced *years* apart from each other.
> I understand. Nevertheless Cmake users need to know the name of the files generated when building with the CMake
> generated file. IMHO, changing output file names from a Cmake to a revision of Cmake can just break build chain.
> Risking this to avoid conflicting sounds odd to me.
>
> Well I got the point, I suspect I'll change my static link to simclist.c.o. Guess it's the best thing to do, right ?
The best thing to do would be to build a static lib
ADD_LIBRARY(simclist STATIC simclist.c)
then to link to your static lib?
Why would you build a shared lib to link statically aftwerwards?
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the CMake
mailing list