[CMake] [Feature-request] CMake Error: Attempt to add link target foo of type: MODULE_LIBRARY

Bill Hoffman bill.hoffman at kitware.com
Thu Apr 26 11:06:59 EDT 2007


Mathieu Malaterre wrote:
> On 4/26/07, Bill Hoffman <bill.hoffman at kitware.com> wrote:
>> Mathieu Malaterre wrote:
>> > Hello,
>> >
>> >  Is this possible to change the error into a warning on system where
>> > there is no difference between module and shared library ? If
>> > CMAKE_MODULE_EXISTS is not set, I think this is resonnable to allow
>> > people to link to module, right ?
>> I don't agree, it will make your cmakelist file unportable.   When built
>> on a system
>> where they are different it won't work.  If it is not a module, then
>> don't build it as
>> a module.
>
> What you are describing is the *implementation* in CMake, you made the
> decision to make MODULE and SHARED different type even on platform
> where there is no difference.
But to be cross platform, we have to go to the least common 
denominator.  If you don't care about the difference, then just use 
SHARED all the time and you will be good.  So, you could do this by your 
self:

if(APPLE)
   // use module
else
   // use shared
endif

But if you need to link to it on one platform, I can't see why you would 
not need to link to it on the platform that requires module to be different.

-Bill



More information about the CMake mailing list