set(EXODUSII_BUILD_SHARED_LIBS "${BUILD_SHARED_LIBS}")

set(sources
  src/deprecated/ex_get_concat_node_sets.c
  src/deprecated/ex_get_concat_side_sets.c
  src/deprecated/ex_get_elem_attr.c
  src/deprecated/ex_get_elem_attr_names.c
  src/deprecated/ex_get_elem_blk_ids.c
  src/deprecated/ex_get_elem_block.c
  src/deprecated/ex_get_elem_conn.c
  src/deprecated/ex_get_elem_map.c
  src/deprecated/ex_get_elem_num_map.c
  src/deprecated/ex_get_elem_var.c
  src/deprecated/ex_get_elem_var_tab.c
  src/deprecated/ex_get_elem_var_time.c
  src/deprecated/ex_get_glob_var_time.c
  src/deprecated/ex_get_glob_vars.c
  src/deprecated/ex_get_n_attr.c
  src/deprecated/ex_get_n_conn.c
  src/deprecated/ex_get_n_coord.c
  src/deprecated/ex_get_n_elem_attr.c
  src/deprecated/ex_get_n_elem_conn.c
  src/deprecated/ex_get_n_elem_num_map.c
  src/deprecated/ex_get_n_elem_var.c
  src/deprecated/ex_get_n_nodal_var.c
  src/deprecated/ex_get_n_node_num_map.c
  src/deprecated/ex_get_n_node_set.c
  src/deprecated/ex_get_n_node_set_df.c
  src/deprecated/ex_get_n_one_attr.c
  src/deprecated/ex_get_n_side_set.c
  src/deprecated/ex_get_n_side_set_df.c
  src/deprecated/ex_get_n_var.c
  src/deprecated/ex_get_nodal_var.c
  src/deprecated/ex_get_nodal_var_time.c
  src/deprecated/ex_get_node_map.c
  src/deprecated/ex_get_node_num_map.c
  src/deprecated/ex_get_node_set.c
  src/deprecated/ex_get_node_set_dist_fact.c
  src/deprecated/ex_get_node_set_ids.c
  src/deprecated/ex_get_node_set_param.c
  src/deprecated/ex_get_nset_var.c
  src/deprecated/ex_get_nset_var_tab.c
  src/deprecated/ex_get_one_elem_attr.c
  src/deprecated/ex_get_partial_elem_attr.c
  src/deprecated/ex_get_partial_elem_conn.c
  src/deprecated/ex_get_partial_elem_map.c
  src/deprecated/ex_get_partial_elem_num_map.c
  src/deprecated/ex_get_partial_elem_var.c
  src/deprecated/ex_get_partial_nodal_var.c
  src/deprecated/ex_get_partial_node_num_map.c
  src/deprecated/ex_get_partial_node_set.c
  src/deprecated/ex_get_partial_node_set_df.c
  src/deprecated/ex_get_partial_side_set.c
  src/deprecated/ex_get_partial_side_set_df.c
  src/deprecated/ex_get_side_set.c
  src/deprecated/ex_get_side_set_dist_fact.c
  src/deprecated/ex_get_side_set_ids.c
  src/deprecated/ex_get_side_set_param.c
  src/deprecated/ex_get_sset_var.c
  src/deprecated/ex_get_sset_var_tab.c
  src/deprecated/ex_get_var_name.c
  src/deprecated/ex_get_var_names.c
  src/deprecated/ex_get_var_param.c
  src/deprecated/ex_get_var_tab.c
  src/deprecated/ex_put_concat_node_sets.c
  src/deprecated/ex_put_concat_side_sets.c
  src/deprecated/ex_put_concat_var_param.c
  src/deprecated/ex_put_elem_attr.c
  src/deprecated/ex_put_elem_attr_names.c
  src/deprecated/ex_put_elem_block.c
  src/deprecated/ex_put_elem_conn.c
  src/deprecated/ex_put_elem_map.c
  src/deprecated/ex_put_elem_num_map.c
  src/deprecated/ex_put_elem_var.c
  src/deprecated/ex_put_elem_var_slab.c
  src/deprecated/ex_put_elem_var_tab.c
  src/deprecated/ex_put_glob_vars.c
  src/deprecated/ex_put_n_attr.c
  src/deprecated/ex_put_n_coord.c
  src/deprecated/ex_put_n_elem_attr.c
  src/deprecated/ex_put_n_elem_conn.c
  src/deprecated/ex_put_n_elem_num_map.c
  src/deprecated/ex_put_n_nodal_var.c
  src/deprecated/ex_put_n_node_num_map.c
  src/deprecated/ex_put_n_node_set.c
  src/deprecated/ex_put_n_node_set_df.c
  src/deprecated/ex_put_n_one_attr.c
  src/deprecated/ex_put_n_side_set.c
  src/deprecated/ex_put_n_side_set_df.c
  src/deprecated/ex_put_n_var.c
  src/deprecated/ex_put_nodal_var_slab.c
  src/deprecated/ex_put_node_map.c
  src/deprecated/ex_put_node_num_map.c
  src/deprecated/ex_put_node_set.c
  src/deprecated/ex_put_node_set_dist_fact.c
  src/deprecated/ex_put_node_set_param.c
  src/deprecated/ex_put_nset_var.c
  src/deprecated/ex_put_nset_var_tab.c
  src/deprecated/ex_put_one_elem_attr.c
  src/deprecated/ex_put_partial_elem_attr.c
  src/deprecated/ex_put_partial_elem_conn.c
  src/deprecated/ex_put_partial_elem_map.c
  src/deprecated/ex_put_partial_elem_num_map.c
  src/deprecated/ex_put_partial_nodal_var.c
  src/deprecated/ex_put_partial_node_num_map.c
  src/deprecated/ex_put_partial_node_set.c
  src/deprecated/ex_put_partial_node_set_df.c
  src/deprecated/ex_put_partial_side_set.c
  src/deprecated/ex_put_partial_side_set_df.c
  src/deprecated/ex_put_side_set.c
  src/deprecated/ex_put_side_set_dist_fact.c
  src/deprecated/ex_put_side_set_param.c
  src/deprecated/ex_put_sset_var.c
  src/deprecated/ex_put_sset_var_tab.c
  src/deprecated/ex_put_var_name.c
  src/deprecated/ex_put_var_names.c
  src/deprecated/ex_put_var_param.c
  src/deprecated/ex_put_var_tab.c

  src/ex_add_attr.c
  src/ex_close.c
  src/ex_conv.c
  src/ex_copy.c
  src/ex_create.c
  src/ex_create_group.c
  src/ex_create_par.c
  src/ex_cvt_nodes_to_sides.c
  src/ex_err.c
  src/ex_get_all_times.c
  src/ex_get_attr.c
  src/ex_get_attr_names.c
  src/ex_get_attr_param.c
  src/ex_get_block.c
  src/ex_get_block_param.c
  src/ex_get_block_params.c
  src/ex_get_cmap_params.c
  src/ex_get_concat_sets.c
  src/ex_get_concat_side_set_node_count.c
  src/ex_get_conn.c
  src/ex_get_coord.c
  src/ex_get_coord_names.c
  src/ex_get_coordinate_frames.c
  src/ex_get_eb_info_global.c
  src/ex_get_elem_cmap.c
  src/ex_get_elem_type.c
  src/ex_get_entity_count_per_polyhedra.c
  src/ex_get_glob_var_time_int.c
  src/ex_get_glob_vars_int.c
  src/ex_get_group_id.c
  src/ex_get_group_ids.c
  src/ex_get_id_map.c
  src/ex_get_ids.c
  src/ex_get_info.c
  src/ex_get_init.c
  src/ex_get_init_ext.c
  src/ex_get_init_global.c
  src/ex_get_init_info.c
  src/ex_get_loadbal_param.c
  src/ex_get_map.c
  src/ex_get_map_param.c
  src/ex_get_name.c
  src/ex_get_names.c
  src/ex_get_nodal_var_int.c
  src/ex_get_nodal_var_time_int.c
  src/ex_get_node_cmap.c
  src/ex_get_ns_param_global.c
  src/ex_get_num_map.c
  src/ex_get_object_truth_vector.c
  src/ex_get_one_attr.c
  src/ex_get_partial_attr.c
  src/ex_get_partial_conn.c
  src/ex_get_partial_coord.c
  src/ex_get_partial_coord_component.c
  src/ex_get_partial_id_map.c
  src/ex_get_partial_nodal_var_int.c
  src/ex_get_partial_num_map.c
  src/ex_get_partial_one_attr.c
  src/ex_get_partial_set.c
  src/ex_get_partial_set_dist_fact.c
  src/ex_get_partial_var.c
  src/ex_get_processor_elem_maps.c
  src/ex_get_processor_node_maps.c
  src/ex_get_prop.c
  src/ex_get_prop_array.c
  src/ex_get_prop_names.c
  src/ex_get_qa.c
  src/ex_get_set.c
  src/ex_get_set_dist_fact.c
  src/ex_get_set_param.c
  src/ex_get_sets.c
  src/ex_get_side_set_node_count.c
  src/ex_get_side_set_node_list.c
  src/ex_get_side_set_node_list_len.c
  src/ex_get_ss_param_global.c
  src/ex_get_time.c
  src/ex_get_truth_table.c
  src/ex_get_var.c
  src/ex_get_var_time.c
  src/ex_get_variable_name.c
  src/ex_get_variable_names.c
  src/ex_get_variable_param.c
  src/ex_inquire.c
  src/ex_int_get_block_param.c
  src/ex_ne_util.c
  src/ex_open.c
  src/ex_open_par.c
  src/ex_opts.c
  src/ex_put_all_var_param.c
  src/ex_put_all_var_param_ext.c
  src/ex_put_attr.c
  src/ex_put_attr_names.c
  src/ex_put_attr_param.c
  src/ex_put_block.c
  src/ex_put_block_param.c
  src/ex_put_block_params.c
  src/ex_put_cmap_params.c
  src/ex_put_cmap_params_cc.c
  src/ex_put_concat_all_blocks.c
  src/ex_put_concat_elem_block.c
  src/ex_put_concat_sets.c
  src/ex_put_conn.c
  src/ex_put_coord.c
  src/ex_put_coord_names.c
  src/ex_put_coordinate_frames.c
  src/ex_put_eb_info_global.c
  src/ex_put_elem_cmap.c
  src/ex_put_entity_count_per_polyhedra.c
  src/ex_put_id_map.c
  src/ex_put_info.c
  src/ex_put_init.c
  src/ex_put_init_ext.c
  src/ex_put_init_global.c
  src/ex_put_init_info.c
  src/ex_put_loadbal_param.c
  src/ex_put_loadbal_param_cc.c
  src/ex_put_map.c
  src/ex_put_map_param.c
  src/ex_put_name.c
  src/ex_put_names.c
  src/ex_put_nodal_var.c
  src/ex_put_nodal_var_int.c
  src/ex_put_node_cmap.c
  src/ex_put_ns_param_global.c
  src/ex_put_num_map.c
  src/ex_put_one_attr.c
  src/ex_put_partial_attr.c
  src/ex_put_partial_conn.c
  src/ex_put_partial_coord.c
  src/ex_put_partial_coord_component.c
  src/ex_put_partial_id_map.c
  src/ex_put_partial_nodal_var_int.c
  src/ex_put_partial_num_map.c
  src/ex_put_partial_one_attr.c
  src/ex_put_partial_set.c
  src/ex_put_partial_set_dist_fact.c
  src/ex_put_partial_var.c
  src/ex_put_processor_elem_maps.c
  src/ex_put_processor_node_maps.c
  src/ex_put_prop.c
  src/ex_put_prop_array.c
  src/ex_put_prop_names.c
  src/ex_put_qa.c
  src/ex_put_set.c
  src/ex_put_set_dist_fact.c
  src/ex_put_set_param.c
  src/ex_put_sets.c
  src/ex_put_ss_param_global.c
  src/ex_put_time.c
  src/ex_put_truth_table.c
  src/ex_put_var.c
  src/ex_put_variable_name.c
  src/ex_put_variable_names.c
  src/ex_put_variable_param.c
  src/ex_threadsafe.c
  src/ex_update.c
  src/ex_utils.c)

if (WIN32)
  set(EXODUS_THREADSAFE 0)
else ()
  set(EXODUS_THREADSAFE 1)
endif ()
set(PARALLEL_AWARE_EXODUS 0)
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/cmake/exodus_config.h.in"
  "${CMAKE_CURRENT_BINARY_DIR}/include/exodus_config.h"
  @ONLY)
configure_file(
  "${CMAKE_CURRENT_SOURCE_DIR}/include/exodusII_cfg.h.in"
  "${CMAKE_CURRENT_BINARY_DIR}/include/exodusII_cfg.h"
  @ONLY)

set(headers
  include/exodusII.h
  include/exodusII_int.h
  include/vtk_exodusII_mangle.h
  "${CMAKE_CURRENT_BINARY_DIR}/include/exodusII_cfg.h"
  "${CMAKE_CURRENT_BINARY_DIR}/include/exodus_config.h")

vtk_add_library(vtkexodusII ${sources} ${headers})
target_link_libraries(vtkexodusII PUBLIC ${vtknetcdf_LIBRARIES})
if (NOT VTK_INSTALL_NO_DEVELOPMENT)
  install(FILES
    ${headers}
    DESTINATION "${VTK_INSTALL_INCLUDE_DIR}/vtkexodusII/include"
    COMPONENT Development)
endif()

target_compile_definitions(vtkexodusII
  PRIVATE
    exoIIc_EXPORTS)
target_include_directories(vtkexodusII
  PUBLIC
    "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
    "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>")
