Update version info for release v4.6.1 (#2122)
[WRF.git] / external / io_pio / CMakeLists.txt
blob130b8921d38aeeb422b3a2044336ddd5d5713a03
1 # WRF CMake Build
3 get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)
5 add_library(
6             ${FOLDER_COMPILE_TARGET}
7               STATIC
8               )
10 target_sources(
11                 ${FOLDER_COMPILE_TARGET}
12                 PRIVATE
13                   wrf_data_pio.F90
14                   pio_routines.F90
15                   wrf_io.F90
16                   field_routines.F90
17                   read_bdy_routines.F90
18                   module_wrfsi_static.F90
19                   )
22 set_target_properties( 
23                       ${FOLDER_COMPILE_TARGET} 
24                         PROPERTIES
25                           Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET}
26                           EXPORT_PROPERTIES        Fortran_MODULE_DIRECTORY
27                       )
30 target_link_libraries(  ${FOLDER_COMPILE_TARGET}
31                           PRIVATE
32                             ${netCDF_LIBRARIES}
33                             $<$<BOOL:${USE_MPI}>:$<TARGET_NAME_IF_EXISTS:MPI::MPI_Fortran>>
34                             $<$<BOOL:${USE_OPENMP}>:$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_Fortran>>
35                         )
37 target_include_directories( ${FOLDER_COMPILE_TARGET}
38                             PRIVATE
39                               ${netCDF_INCLUDE_DIRS}
40                               ${CMAKE_CURRENT_SOURCE_DIR}
41                             )
43 install(
44         TARGETS ${FOLDER_COMPILE_TARGET}
45         EXPORT  ${EXPORT_NAME}Targets
46         RUNTIME DESTINATION bin/
47         ARCHIVE DESTINATION lib/
48         LIBRARY DESTINATION lib/
49         )