Re: [CMake] creating static library with references to other .lib files

2007-06-18 Thread Jesper Eskilson

2007/6/14, David Cole <[EMAIL PROTECTED]>:

It's "advanced" CMake use, but you might want to have a look at overriding
the CMake "rule variable" CMAKE_CXX_CREATE_STATIC_LIBRARY.
(Or _C_ if it's C source code.) You should be able to add some linker flags
in there, although they may apply to all static libraries built in the whole
project. I'm not 100% clear myself on how these rule variables work...

Perhaps somebody else who has used a technique like this can chime in?


Setting CMAKE_CXX_CREATE_STATIC_LIBRARY has no effect on the generated
vcproj file. In fact, the value set by CMake in
CMakeCXXInformation.cmake does not seem to be used in the vcproj file.

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-15 Thread Jesper Eskilson

2007/6/15, kitts <[EMAIL PROTECTED]>:


On Thursday 14 Jun 2007 12:23:07 pm Jesper Eskilson wrote:
> Is it really impossible to pass an option to the linker when creating a
> static library?

I have not gone through the whole thread but i think the function
SET_TARGET_PROPERTIES(TARGET LINK_FLAGS "XYZ") can do it.

The problem i foresee  is that when you pass another library as a source
file
to a library, cmake may not pass this file as an argument when building
your
library.



Setting the LINK_FLAGS property does not work. CMake keeps track of the
dependency, so everything works nice inside CMake, but not when we ship the
library to our customers (since they only link with the original library).

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-15 Thread kitts
On Thursday 14 Jun 2007 12:23:07 pm Jesper Eskilson wrote:
> Is it really impossible to pass an option to the linker when creating a
> static library?

I have not gone through the whole thread but i think the function 
SET_TARGET_PROPERTIES(TARGET LINK_FLAGS "XYZ") can do it.

The problem i foresee  is that when you pass another library as a source file 
to a library, cmake may not pass this file as an argument when building your 
library.
-- 
Cheers!
kitts
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-14 Thread Brandon Van Every

On 6/14/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:


Is it really impossible to pass an option to the linker when creating a
static library?


It's not terribly difficult.  But I thought I'd save you the learning
curve if it wasn't necessary.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-14 Thread David Cole

It's "advanced" CMake use, but you might want to have a look at overriding
the CMake "rule variable" CMAKE_CXX_CREATE_STATIC_LIBRARY. (Or _C_ if it's C
source code.) You should be able to add some linker flags in there, although
they may apply to all static libraries built in the whole project. I'm not
100% clear myself on how these rule variables work...

Perhaps somebody else who has used a technique like this can chime in?


HTH,
David

On 6/14/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:




2007/6/14, Brandon Van Every <[EMAIL PROTECTED]>:
>
> On 6/13/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:
> > 2007/6/13, Brandon Van Every <[EMAIL PROTECTED]>:
> > >
> > > But why don't you just ship your users a dynamic lib?  As far as I
> > > know, there are no restrictions on dynamic libs including static
> libs.
> >
> > That is an alternative, but it requires a non-trivial amount of work,
> > testing, documentation fixes etc., which I'd prefer not to embark on
> > at the moment.
>
> I take it you have no infrastructure for dynamic libs at all in your
> code then?  Because if you did, like all your declspecs and so forth,
> it's pretty easy to add in CMake.


The problem isn't CMake in that case, it's updating all the stuff around
it which assumes that the lib is static: documentation (the lib is part of a
SDK shipped to customers), testing, etc. That's not something I want to do
at this time.

Is it really impossible to pass an option to the linker when creating a
static library?

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-13 Thread Jesper Eskilson

2007/6/14, Brandon Van Every <[EMAIL PROTECTED]>:


On 6/13/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:
> 2007/6/13, Brandon Van Every <[EMAIL PROTECTED]>:
> >
> > But why don't you just ship your users a dynamic lib?  As far as I
> > know, there are no restrictions on dynamic libs including static libs.
>
> That is an alternative, but it requires a non-trivial amount of work,
> testing, documentation fixes etc., which I'd prefer not to embark on
> at the moment.

I take it you have no infrastructure for dynamic libs at all in your
code then?  Because if you did, like all your declspecs and so forth,
it's pretty easy to add in CMake.



The problem isn't CMake in that case, it's updating all the stuff around it
which assumes that the lib is static: documentation (the lib is part of a
SDK shipped to customers), testing, etc. That's not something I want to do
at this time.

Is it really impossible to pass an option to the linker when creating a
static library?

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-13 Thread Brandon Van Every

On 6/13/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:

2007/6/13, Brandon Van Every <[EMAIL PROTECTED]>:
>
> But why don't you just ship your users a dynamic lib?  As far as I
> know, there are no restrictions on dynamic libs including static libs.

That is an alternative, but it requires a non-trivial amount of work,
testing, documentation fixes etc., which I'd prefer not to embark on
at the moment.


I take it you have no infrastructure for dynamic libs at all in your
code then?  Because if you did, like all your declspecs and so forth,
it's pretty easy to add in CMake.  Really the only gotcha is if your
shared and static library names collide, then you need to deal with
the CLEAN_DIRECT_OUTPUT stuff, as per the docs.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-13 Thread Keith T. Garner
On 6/12/07 5:36 PM, Jesper Eskilson wrote:
> What you're asking for seems kinda weird.  What's the motive?
> 
> foo.obj and bar.obj uses symbols in mydll.dll, and I want to allow users
> of mystatic.lib to just have to link with mystaticlib.lib, and not with
> mydll.lib.
> 
> Note that an import library on Windows *is* a static library (both
> having the .lib suffix is not a coincidence). The only special thing
> with an import library is that it exports symbols with a note that the
> symbol really should be found at runtime in the given dll. So,
> 
> lib /out:foo.lib bar.obj fie.lib
> 
> puts all the contents of bar.obj and fie.lib into foo.lib. This is very
> practical.
> 
> Hope that makes it a little clearer.

For the record, I have the exact same need for a library that my department
puts out.  Its one of the things keeping me from moving over to CMake for
our project[1].  Its so much easier to distribute the win32 version this
way.  One of our other projects is also dependent on that behavior.  I could
change that, but I'd rather figure out how to have CMake build this way.

Keith

[1] http://www.crt.realtors.org/projects/rets/librets

-- 
 Keith T. Garner[EMAIL PROTECTED]
"Make no little plans; they have no magic to
   stir men's blood." - Daniel H. Burnham

___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Fwd: [CMake] creating static library with references to other .lib files

2007-06-13 Thread Jesper Eskilson

Forgot to cc the list.

-- Forwarded message --
From: Jesper Eskilson <[EMAIL PROTECTED]>
Date: 2007-jun-13 19:56
Subject: Re: [CMake] creating static library with references to other .lib files
To: Brandon Van Every <[EMAIL PROTECTED]>


2007/6/13, Brandon Van Every <[EMAIL PROTECTED]>:


Ok, so MSVC can do it, but AR can't.  So I guess you only care about MSVC.


Yes. Sorry, I forgot to say that.


> > What you're asking for seems kinda weird.  What's the motive?
> >
>
> foo.obj and bar.obj uses symbols in mydll.dll, and I want to allow users of
> mystatic.lib to just have to link with mystaticlib.lib, and not with
> mydll.lib.

But why don't you just ship your users a dynamic lib?  As far as I
know, there are no restrictions on dynamic libs including static libs.


That is an alternative, but it requires a non-trivial amount of work,
testing, documentation fixes etc., which I'd prefer not to embark on
at the moment.

I'm actually happy if I just can get hold of a CMake variable where I
can put extra flags to pass to lib when creating a static lib.
Something like

set(CMAKE_STATIC_LINKER_FLAGS "...")

--
/Jesper


--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-13 Thread Brandon Van Every

On 6/12/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:

2007/6/12, Brandon Van Every <[EMAIL PROTECTED]>:
>
> I don't know what the MSVC linker can accomplish.  Would suggest reading
the MSVC docs to make sure it can be done.

I *know* that it can be done, since our current hand-written .vcproj files
do it.


Ok, so MSVC can do it, but AR can't.  So I guess you only care about MSVC.


> What you're asking for seems kinda weird.  What's the motive?
>

foo.obj and bar.obj uses symbols in mydll.dll, and I want to allow users of
mystatic.lib to just have to link with mystaticlib.lib, and not with
mydll.lib.


But why don't you just ship your users a dynamic lib?  As far as I
know, there are no restrictions on dynamic libs including static libs.

I wonder if you can yank out the object files of an arbitrary static
lib and stick them in your own static lib.  I didn't try that approach
because I have control of all my libs, I'm not using any 3rd party
libs.


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] creating static library with references to other .lib files

2007-06-12 Thread Jesper Eskilson

2007/6/12, Brandon Van Every <[EMAIL PROTECTED]>:



On some platforms, I bet the underlying linker AR can't even do it.  I
know it can't put static libraries inside of static libraries, thats' why
everyone wants "convenience libraries" and I had to work on all that object
file fakery.  Possibly it can't take a DLL stub .lib either.  So, if there
is a solution for some platforms, it's not likely to be portable.

I don't know what the MSVC linker can accomplish.  Would suggest reading
the MSVC docs to make sure it can be done.



I *know* that it can be done, since our current hand-written .vcproj files
do it. I simply want CMake to allow me to create a static library using a
command line such as:

lib /out:mystaticlib.lib foo.obj bar.obj mydll.lib

where mydll.lib is an import lib for mydll.dll.

What you're asking for seems kinda weird.  What's the motive?





foo.obj and bar.obj uses symbols in mydll.dll, and I want to allow users of
mystatic.lib to just have to link with mystaticlib.lib, and not with
mydll.lib.

Note that an import library on Windows *is* a static library (both having
the .lib suffix is not a coincidence). The only special thing with an import
library is that it exports symbols with a note that the symbol really should
be found at runtime in the given dll. So,

lib /out:foo.lib bar.obj fie.lib

puts all the contents of bar.obj and fie.lib into foo.lib. This is very
practical.

Hope that makes it a little clearer.

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-12 Thread Brandon Van Every

On 6/12/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:




2007/6/7, Jesper Eskilson <[EMAIL PROTECTED]>:
>
>
>
> 2007/6/7, Brandon Van Every < [EMAIL PROTECTED]>:
> >
> > On 6/7/07, Jesper Eskilson < [EMAIL PROTECTED]> wrote:
> > > Hi all,
> > >
> > > I would like to be able to create a static library on Windows which
> > > includes an import library to a DLL, so that users of the static
> > > library do not need to specify the import library.
> >
> >
I'm still interested in a solution to my original problem, though.




On some platforms, I bet the underlying linker AR can't even do it.  I know
it can't put static libraries inside of static libraries, thats' why
everyone wants "convenience libraries" and I had to work on all that object
file fakery.  Possibly it can't take a DLL stub .lib either.  So, if there
is a solution for some platforms, it's not likely to be portable.

I don't know what the MSVC linker can accomplish.  Would suggest reading the
MSVC docs to make sure it can be done.

What you're asking for seems kinda weird.  What's the motive?


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-12 Thread Jesper Eskilson

2007/6/7, Jesper Eskilson <[EMAIL PROTECTED]>:




2007/6/7, Brandon Van Every <[EMAIL PROTECTED]>:
>
> On 6/7/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:
> > Hi all,
> >
> > I would like to be able to create a static library on Windows which
> > includes an import library to a DLL, so that users of the static
> > library do not need to specify the import library.
>
> By chance, is your library a C library that is commonly available to
> the public, i.e. is typically present in Linux or Cygwin distributions
> and whatnot?  If so, you have a problem that will likely sidestep the
> issue / render it moot.  Regardless of the choice of linkage, you
> could suffer a namespace collision between the version you're
> maintaining in your own code, and the publically available version.
> Segfaults etc.  Here's the issue in our bug tracker that we haven't
> resolved yet, it gives a lot of detail as to what kinds of things can
> go wrong.  http://trac.callcc.org/ticket/215


I think we have all our bases covered, but thanks anyway.



I'm still interested in a solution to my original problem, though.

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-07 Thread Jesper Eskilson

2007/6/7, Brandon Van Every <[EMAIL PROTECTED]>:


On 6/7/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I would like to be able to create a static library on Windows which
> includes an import library to a DLL, so that users of the static
> library do not need to specify the import library.

By chance, is your library a C library that is commonly available to
the public, i.e. is typically present in Linux or Cygwin distributions
and whatnot?  If so, you have a problem that will likely sidestep the
issue / render it moot.  Regardless of the choice of linkage, you
could suffer a namespace collision between the version you're
maintaining in your own code, and the publically available version.
Segfaults etc.  Here's the issue in our bug tracker that we haven't
resolved yet, it gives a lot of detail as to what kinds of things can
go wrong.  http://trac.callcc.org/ticket/215



I think we have all our bases covered, but thanks anyway.

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Re: [CMake] creating static library with references to other .lib files

2007-06-07 Thread Brandon Van Every

On 6/7/07, Jesper Eskilson <[EMAIL PROTECTED]> wrote:

Hi all,

I would like to be able to create a static library on Windows which
includes an import library to a DLL, so that users of the static
library do not need to specify the import library.


By chance, is your library a C library that is commonly available to
the public, i.e. is typically present in Linux or Cygwin distributions
and whatnot?  If so, you have a problem that will likely sidestep the
issue / render it moot.  Regardless of the choice of linkage, you
could suffer a namespace collision between the version you're
maintaining in your own code, and the publically available version.
Segfaults etc.  Here's the issue in our bug tracker that we haven't
resolved yet, it gives a lot of detail as to what kinds of things can
go wrong.  http://trac.callcc.org/ticket/215


Cheers,
Brandon Van Every
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


[CMake] creating static library with references to other .lib files

2007-06-07 Thread Jesper Eskilson

Hi all,

I would like to be able to create a static library on Windows which
includes an import library to a DLL, so that users of the static
library do not need to specify the import library.

CMake does not allow me to do this.

TARGET_LINK_LIBRARIES( FooLib BarLib )

does not work when creating static libraries.

SET_TARGET_PROPERTIES( FooLib PROPERTIES LINK_FLAGS_RELEASE BarLib )

does not work either.

What to do?

--
/Jesper
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake