#
# heat and bmi_heat
#
add_library(heatf SHARED heat.f90)
add_library(bmiheatf SHARED bmi_heat.f90 heat.f90)

add_executable(run_heatf main.f90)
target_link_libraries(run_heatf heatf)

install(
  TARGETS run_heatf
  RUNTIME DESTINATION bin
)
install(
  TARGETS heatf bmiheatf
  LIBRARY DESTINATION lib
)
install(
  FILES
    ${CMAKE_BINARY_DIR}/heat/heat.mod
    ${CMAKE_BINARY_DIR}/heat/bmi_heat.mod
  DESTINATION include
)

#
# heat and bmi_heat
#
set(model_name heatf90)

add_library(${model_name} SHARED heat.f90)
add_library(bmi${model_name} SHARED bmi_heat.f90 heat.f90)

add_executable(run_${model_name} main.f90)
target_link_libraries(run_${model_name} ${model_name})

install(
  TARGETS run_${model_name}
  RUNTIME DESTINATION bin
)
install(
  TARGETS ${model_name} bmi${model_name}
  LIBRARY DESTINATION lib
)
install(
  FILES
    ${CMAKE_BINARY_DIR}/heat/heat.mod
    ${CMAKE_BINARY_DIR}/heat/bmi_heat.mod
  DESTINATION include
)

Change library and executable name to prevent conflict with bmi-fortran
Change library and executable name to prevent conflict with bmi-fortran
