We're updating the issue view to help you get more done. 

Can't compile using MSVC & IVF on windows (MSVS 14)

Description

A requirement of a project I am working on is to statically link against CGNS on windows, including the Fortran interfaces.

I have tried to compile on Windows 10, using the CMake files and using the "Visual Studio 14 2015 Win64" generator. The C compiler is the default MSVC compiler, and the fortran compiler is Intel IVF 18.0.3.

I have tried setting the CMake configuration according to both the "Building on Windows" section of the FAQ, and the configure options being passed to CMake in the AppVeyor CI testing in the main CGNS repository.

I have downloaded the v3.3.1 release from the github releases page.

UPDATE: A work around has been identified

The work around is to explicitly set the linker language to C for `cgns_static`

1 set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C)

Environment

Here is the external project definition and configuration that I am using:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 # ------ # NetCDF # ------ # list(APPEND DEPENDENCIES netCDF-4) # ExternalProject_Add( netCDF-4 # URL https://github.com/Unidata/netcdf-c/archive/v4.6.1.tar.gz # URL_HASH SHA256=a2fabf27c72a5ee746e3843e1debbaad37cd035767eaede2045371322211eebb # TLS_VERIFY ON # CMAKE_CACHE_ARGS ${DEFAULT_CACHE_ARGS} -DENABLE_NETCDF_4:BOOL=ON -DENABLE_DAP:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DENABLE_TESTS:BOOL=ON # BUILD_IN_SOURCE OFF # TEST_BEFORE_INSTALL ON) # ---- # CGNS # ---- list(APPEND DEPENDENCIES CGNS) # See http://cgns.github.io/FAQs.html (Installation Questions--Outdated as of 2018-09-14) # See also https://github.com/CGNS/CGNS/blob/4858d3852453770d2de63bcf8b0e5568daa362e4/appveyor.yml list(APPEND CGNS_CONFIG ${DEFAULT_CACHE_ARGS} -DCGNS_ENABLE_FORTRAN:BOOL=OFF -DCGNS_BUILD_SHARED:BOOL=OFF -DCGNS_USE_SHARED:BOOL=OFF -DCGNS_ENABLE_64BIT:BOOL=ON -DCGNS_BUILD_CGNSTOOLS:BOOL=OFF -DCGNS_ENABLE_TESTS:BOOL=ON -DCGNS_VERBOSE_MAKEFILE:BOOL=ON -DCGNS_ENABLE_HDF5:BOOL=ON -DCGNS_ENABLE_PARALLEL:BOOL=OFF -DCGNS_ENABLE_LFS:BOOL=OFF -DCGNS_ENABLE_SCOPING:BOOL=OFF -DHDF5_NEED_ZLIB:BOOL=ON ) if(WIN32) list(APPEND CGNS_CONFIG -DCMAKE_STATIC_LINKER_FLAGS:STRING= -DCMAKE_C_FLAGS:STRING= ) endif() message(STATUS "Flags passed during CGNS configuration: ${CGNS_CONFIG}") ExternalProject_Add( CGNS DEPENDS hdf5 URL https://github.com/CGNS/CGNS/archive/v3.3.1.tar.gz URL_HASH SHA256=81093693b2e21a99c5640b82b267a495625b663d7b8125d5f1e9e7aaa1f8d469 TLS_VERIFY ON CMAKE_CACHE_ARGS ${CGNS_CONFIG} BUILD_IN_SOURCE OFF TEST_BEFORE_INSTALL ON)

I run CMake to configure and build the CGNS portion of the project (HDF5 was already installed, v1.10.3, from https://gamma.hdfgroup.org/ftp/pub/outgoing/QATEST/hdf5110/binaries/windows/hdf5-1.10.3-Std-win10_64-vs14.zip) like this:

1 cmake .. -G "Visual Studio 14 2015 Win64" && cmake --build . --target CGNS --config Release

Status

Assignee

Izaak Beekman

Reporter

Izaak Beekman

Labels

None

Fix versions

Affects versions

3.3.1

Priority

Blocker