We have implemeted this with our "UserOptions" cmake hooks. Feel free to use
the same technique.
"BUILD_SHARED_LIBS=OFF" should only control the library under build, not how
it is linked to CRT libraries. Which is Ward's understanding as well.
Allen
On Wednesday, September 18, 2013 02:05:01 PM Ward Fisher wrote:
> On 9/18/13 1:36 PM, Pedro Vicente wrote:
> > Hi Ward
> >
> >>> Can you be a little more specific about how this does not work?
> >>> Is the issue that the generated projects are configured to use the
> >>> the dynamic instead of static CRT?
> >
> > Yes, I meant that the the generated projects were all runtime library
> > Multi-threaded Debug DLL (/MDd).
> >
> > I was under the impression that if I do -D"BUILD_SHARED_LIBS=OFF",
> > then the projects would be static CRT ?
> > Or is this option, just relative to the netCDF library itself,
> > netcdf.lib ? In this case, my bad, sorry for the confusion.
>
> I'm not sure what you mean by 'the projects would be static CRT'. The
> file netcdf.lib would be a static library, but not a CRT. The Microsoft
> C Run-Time Libraries (CRT) are a specific set of system libraries,
> enumerated here:
>
> http://msdn.microsoft.com/en-us/library/abx4dbyh(v=vs.100).aspx
>
> It is possible to compile the netCDF library as a static object (a
> standard 'ar' archive) that still has dependencies on shared libraries,
> such as the hdf5 or libcurl dll's.
>
> In the current system up to netCDF-C 4.3.1-rc2, netCDF was being built
> statically, with a dependency on the shared CRT libraries. With the
> changes previously described, it will be possible to (easily) build the
> netCDF library and utilities statically, with a dependency on the static
> CRT libraries.
>
> In either case, the netCDF library and utilities are static; the
> difference is in which library (CRT) was being linked against.
>
> I hope this clarifies things; the new option (NC_USE_STATIC_CRT) is
> being added and should be in the upcoming 4.3.1-rc3 release.
>
> -Ward
>
> >>> I see how this could be set as a user-configurable option when
> >>> invoking cmake. I will try to add this in and, assuming there
> >>> aren't any problems caused by using the static CRT, it will be an
> >>> option available in the >>upcoming netCDF-4.3.1-RC3.
> >
> > OK, great, thanks
> >
> >
> > Allen, maybe the HD5 Cmake could use the same ?
> >
> > Pedro
> >
> > ------------
> > pvicente@xxxxxxx
> > Department of Earth System Science
> > 3200 Croul Hall
> > University of California, Irvine
> > Irvine, CA 92697-3100