[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #CYY-632936]: Potential bugs in cmake files for msvc builds with explicit paths to hdf5 .lib files



Hello Roel,

No problem; either list is fine, although the support email comes here to the 
Unidata developers directly, and the mailing list goes out to the broader 
Unidata community.  

I appreciate your suggestions for the CMakeLists.txt files on Windows; I'll 
take a look when I have some time and see if I can implement some of the 
improvements you suggest.  The documentation should *definitely* be updated, 
however.  I've created an issue for this on our GitHub page, viewable here:

* https://github.com/Unidata/netcdf-c/issues/222

Regarding your question related to specifying debug and compile versions of the 
library and dependencies; there is no way to do this currently other than 
running cmake twice, as you are doing.  If you can provide reference to 'best 
practices' information regarding this sort of thing, I should be able to add it 
fairly quickly.  Otherwise, it will probably wait until I have time to dig into 
it myself, which may be a bit.

Thanks again for the suggestions; you can monitor (and comment on) the link 
above for information regarding the issue and the progress towards getting 
improvements into the 4.4.1 release.  Alternatively, feel free to continue the 
discussion by contacting us through this support email.

Thanks, have a great day,

-Ward

> (I wasn't sure which was the appropriate contact for my report, hence
> I'm sending it to support@ as well as the mailing list; apologies if
> this causes double mails for some people)
> 
> Hi,
> 
> I've been building netcdf 4.4.0 today and I ran into a couple of issues
> that I think are bugs in the cmake files. I don't know what the more
> abstract build system philosophies are so I took only the required
> steps to get it to work for me, but since this prevents me from making
> automated builds I'd appreciate it if the maintainers of the build
> system could suggest and hopefully even implement a proper fix to be
> included in future releases (unless I'm just using everything wrong,
> in which case I'd appreciate it if somebody would set me straight.)
> 
> My situation is msvc14 (= Visual Studio 2015), with HDF5 in a
> non-standard location (i.e., no .cmake files availables). According
> to docs/cmake_faq.md this can be made to work with some cmake defines,
> but I ran into the following issues:
> 
> - Documentation is wrong on the names of the parameters to pass to cmake:
> HDF5_HL_LIB should be HDF5_HL_LIBRARY and HDF5_LIB should be
> HDF5_C_LIBRARY, if I look around lines 494 of CMakeLists.txt
> 
> - There is an issue with backslashes in those paths; if you try to use
> backslashes, cmake fails (thinks it's an escape character). In my
> batch file I replaced backslashes with forward slashes; it would be
> more user-friendly (imo) if the netcdf cmakefile would do a s|\|/|g
> itself, as I've found suggested on some websites to other cmake-based
> library maintainers.
> 
> - Then, in the generated .vcproj, the netcdf4 project file doesn't have
> C:\source\vendor\include\HDF5\ (which is what I passed to
> HDF5_INCLUDE_DIR) added to its include directories. This seems to be
> because the cmake file does INCLUDE_DIRECTORIES(${HDF5_INCLUDE_DIR})
> within the 'else' section that is only ran when not explicitly setting
> the above-mentioned variables (i.e., only set when the find_package
> approach is used)
> 
> - When linking against hdf5 dynamically, H5_BUILT_AS_DYNAMIC_LIB should be
> set as a preprocessor flag, otherwise the HDF5 declspec's will be
> wrong and the linker will fail to find the right imports in the .lib.
> 
> Then finally, and this is more a general question, there doesn't seem to
> be a way to pass different hdf5 libraries to release and debug builds? I'd
> like to pass hdf5d.lib to debug builds, hdf5.lib to release. For now
> I make do with running cmake twice but it would be nice if this would
> work in one go.
> 
> Thanks
> 
> Cheers,
> 
> Roel
> 
> 

Ticket Details
===================
Ticket ID: CYY-632936
Department: Support netCDF
Priority: Normal
Status: Closed