3 get_filename_component( FOLDER_COMPILE_TARGET ${CMAKE_CURRENT_SOURCE_DIR} NAME)
6 ${FOLDER_COMPILE_TARGET}
10 # Do this first to simplify steps later
11 set_target_properties(
12 ${FOLDER_COMPILE_TARGET}
14 Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/${FOLDER_COMPILE_TARGET}
15 EXPORT_PROPERTIES Fortran_MODULE_DIRECTORY
19 target_link_libraries(
20 ${FOLDER_COMPILE_TARGET}
22 $<$<BOOL:${USE_OPENMP}>:$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_Fortran>>
23 $<$<BOOL:${USE_MPI}>:$<TARGET_NAME_IF_EXISTS:MPI::MPI_Fortran>>
25 ${netCDF-Fortran_LIBRARIES}
28 # Because of the way netCDF provides its info and the way cmake auto-gens RPATH, we need to help it along
29 target_link_directories(
30 ${FOLDER_COMPILE_TARGET}
33 ${netCDF-Fortran_LIBRARY_DIR}
36 target_include_directories(
37 ${FOLDER_COMPILE_TARGET}
39 $<TARGET_PROPERTY:${FOLDER_COMPILE_TARGET},Fortran_MODULE_DIRECTORY>
40 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/ioapi_share>
41 $<INSTALL_INTERFACE:include/external/ioapi_share>
42 ${netCDF_INCLUDE_DIRS}
43 ${netCDF-Fortran_INCLUDE_DIRS}
45 ${CMAKE_CURRENT_SOURCE_DIR}
50 get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES )
51 wrf_c_preproc_fortran(
52 TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io
53 OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/
55 INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES}
56 DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS}
61 wrf_m4_preproc_fortran(
62 TARGET_NAME ${FOLDER_COMPILE_TARGET}_m4_preproc_wrf_io
63 OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/
66 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/preproc/wrf_io.f90
67 DEPENDENCIES ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io
68 TARGET_SCOPE ${FOLDER_COMPILE_TARGET}
72 add_dependencies( ${FOLDER_COMPILE_TARGET} ${FOLDER_COMPILE_TARGET}_m4_preproc_wrf_io )
75 ${FOLDER_COMPILE_TARGET}
77 ${CMAKE_CURRENT_BINARY_DIR}/preproc/m4_preproc_wrf_io.f90
78 module_wrfsi_static.F90
83 set( DIFFWRF_TARGET diffwrf_ncpar )
87 ${PROJECT_SOURCE_DIR}/frame/clog.c
88 ${PROJECT_SOURCE_DIR}/frame/module_wrf_error.F
89 ${PROJECT_SOURCE_DIR}/frame/wrf_debug.F
92 target_link_libraries(
95 ${FOLDER_COMPILE_TARGET}
97 set_target_properties(
100 # Just dump everything in here
101 Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${DIFFWRF_TARGET}
107 TARGETS ${FOLDER_COMPILE_TARGET} ${DIFFWRF_TARGET}
108 EXPORT ${EXPORT_NAME}Targets
109 RUNTIME DESTINATION bin/
110 ARCHIVE DESTINATION lib/
111 LIBRARY DESTINATION lib/