Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

package with static libraries still has linkage dynamic? Help? #117

Open
AnEnglishmanInNorway opened this issue Nov 24, 2015 · 4 comments
Open

Comments

@AnEnglishmanInNorway
Copy link

I really hate to pester the community with this, because I'm sure it is me that is not understanding how to use the tool, rather than a problem. I have created a package which contains only header files and one static library. When I use the package, it finds the header files perfectly, but does not find the libraries. The libraries are specified like this:

    [x86,debug,static] lib: { lib\KM.Numerical.Csd.lib };
    [x86,release,static] lib: { lib\KM.Numerical.Cs.lib };

When I look at the generated .targets file it contains things like this

  <ItemDefinitionGroup Label="Win32 and static and Debug" Condition="'$(Platform.ToLower())' == 'win32' And '$(Linkage-KM_Numerical_C.ToLower())' == 'static' And ( $(Configuration.ToLower().IndexOf('debug')) &gt; -1 )">
    <Link>
      <AdditionalDependencies>$(MSBuildThisFileDirectory)../..//build/native/lib/Win32\static\Debug\KM.Numerical.Csd.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>

which looks vaguely ok to me, except that I can find no place where $(Linkage-KM_Numerical_C) is set to "static". It has a default dynamic, set in the .targets file, like this:

Linkage-KM_Numerical_C Condition="'$(Linkage-KM_Numerical_C)' == ''">dynamic</Linkage-KM_Numerical_C>

but no other setting that I can see. Where/how do I make sure that this Linkage variable is set to static?

@NN---
Copy link

NN--- commented Dec 20, 2015

+1

@NN---
Copy link

NN--- commented Jan 3, 2016

@AnEnglishmanInNorway Did you find a solution ?

@AnEnglishmanInNorway
Copy link
Author

No, I didn't. I simply went for dll, and deferred the entire problem. And
the guy I was helping has not yet come back to me with a wish for the
static version.
Cheers
Pete

On 3 January 2016 at 12:50, NN [email protected] wrote:

@AnEnglishmanInNorway https://github.com/AnEnglishmanInNorway Did you
find a solution ?


Reply to this email directly or view it on GitHub
#117 (comment)
.

[email protected]
How about joining me as a microfinance lender?
http://kiva.org/invitedby/pete7478

@NN---
Copy link

NN--- commented Jan 4, 2016

Duplicate for #70 #94

Currently it is done manually using property pages.
Not ideal but better than nothing.
It is needed to determine automatically without editing manually , but it seems not easy since ClCompile.RuntimeLibrary is a custom MSBuild property and it cannot be used in Condition directly.
I think there is some workaround but I am not expert in MSBuild .

Just choose manually 'Static' if you build /MT or 'Dynamic' if you build /MD and it works:
Sample

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants