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>>
28 target_include_directories(
29 ${FOLDER_COMPILE_TARGET}
31 $<TARGET_PROPERTY:${FOLDER_COMPILE_TARGET},Fortran_MODULE_DIRECTORY>
32 $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/external/ioapi_share>
33 $<INSTALL_INTERFACE:include/external/ioapi_share>
35 ${CMAKE_CURRENT_SOURCE_DIR}
40 get_target_property ( FOLDER_COMPILE_TARGET_INCLUDES ${FOLDER_COMPILE_TARGET} INCLUDE_DIRECTORIES )
41 wrf_c_preproc_fortran(
42 TARGET_NAME ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io
43 OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/
45 INCLUDES ${FOLDER_COMPILE_TARGET_INCLUDES}
46 DEFINITIONS ${PROJECT_COMPILE_DEFINITIONS}
51 wrf_m4_preproc_fortran(
52 TARGET_NAME ${FOLDER_COMPILE_TARGET}_m4_preproc_wrf_io
53 OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/preproc/
56 SOURCES ${CMAKE_CURRENT_BINARY_DIR}/preproc/wrf_io.f90
57 DEPENDENCIES ${FOLDER_COMPILE_TARGET}_c_preproc_wrf_io
58 TARGET_SCOPE ${FOLDER_COMPILE_TARGET}
62 add_dependencies( ${FOLDER_COMPILE_TARGET} ${FOLDER_COMPILE_TARGET}_m4_preproc_wrf_io )
65 ${FOLDER_COMPILE_TARGET}
67 ${CMAKE_CURRENT_BINARY_DIR}/preproc/m4_preproc_wrf_io.f90
68 module_wrfsi_static.F90
73 set( DIFFWRF_TARGET diffwrf_ncpar )
77 ${PROJECT_SOURCE_DIR}/frame/clog.c
78 ${PROJECT_SOURCE_DIR}/frame/module_wrf_error.F
79 ${PROJECT_SOURCE_DIR}/frame/wrf_debug.F
82 target_link_libraries(
85 ${FOLDER_COMPILE_TARGET}
87 set_target_properties(
90 # Just dump everything in here
91 Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${DIFFWRF_TARGET}
97 TARGETS ${FOLDER_COMPILE_TARGET} ${DIFFWRF_TARGET}
98 EXPORT ${EXPORT_NAME}Targets
99 RUNTIME DESTINATION bin/
100 ARCHIVE DESTINATION lib/
101 LIBRARY DESTINATION lib/