2 set( FOLDER_COMPILE_TARGETS )
4 add_compile_options ( "${PROJECT_COMPILE_OPTIONS}" )
5 add_compile_definitions( "${PROJECT_COMPILE_DEFINITIONS}" )
7 # First make true executables
8 if ( ${WRF_CORE} STREQUAL "PLUS" )
14 list( APPEND FOLDER_COMPILE_TARGETS wrfplus )
16 # I believe this is always made if not WRF PLUS or ESMF
22 list( APPEND FOLDER_COMPILE_TARGETS wrf )
23 # #!TODO When does this get activated?
31 # list( APPEND FOLDER_COMPILE_TARGETS em_wrf_SST_ESMF )
34 # Use case info from higher CMakeLists.txt
35 set( MODULE_FILE ${PROJECT_SOURCE_DIR}/dyn_em/module_initialize_${WRF_CASE_MODULE}.F )
37 if ( ${WRF_CASE} STREQUAL "EM_REAL" )
53 list( APPEND FOLDER_COMPILE_TARGETS ndown tc real )
55 elseif( NOT ${WRF_GENERAL_IDEAL_CASE} ) # Not general ideal and not real
56 # All others are variants of ideal
62 list( APPEND FOLDER_COMPILE_TARGETS ideal )
64 # greater than or equal to general ideal case
68 ${PROJECT_SOURCE_DIR}/dyn_em/module_initialize_ideal.F
70 list( APPEND FOLDER_COMPILE_TARGETS ideal )
74 foreach ( TARGET ${FOLDER_COMPILE_TARGETS} )
75 set_target_properties(
78 # Just dump everything in here
79 Fortran_MODULE_DIRECTORY ${CMAKE_INSTALL_PREFIX}/modules/${TARGET}/
85 set_target_properties(
88 INTERPROCEDURAL_OPTIMIZATION TRUE
91 if ( ${CMAKE_VERSION} VERSION_LESS 3.24 )
92 target_link_libraries(
98 # Static libraries with LTO/IPO sometimes don't pull all the correct symbols
99 set( LINKER_OPTION ${CMAKE_Fortran_LINKER_WRAPPER_FLAG} )
103 ${LINKER_OPTION}--whole-archive $<TARGET_FILE:${PROJECT_NAME}_Core> ${LINKER_OPTION}--no-whole-archive
106 target_link_libraries(
109 $<LINK_LIBRARY:WHOLE_ARCHIVE,${PROJECT_NAME}_Core>
113 target_link_libraries(
120 target_include_directories(
123 ${PROJECT_SOURCE_DIR}/inc
124 ${PROJECT_BINARY_DIR}/inc
125 $<TARGET_PROPERTY:${PROJECT_NAME}_Core,Fortran_MODULE_DIRECTORY>
131 TARGETS ${FOLDER_COMPILE_TARGETS}
132 RUNTIME DESTINATION bin/
133 ARCHIVE DESTINATION lib/
134 LIBRARY DESTINATION lib/
137 # Install the "run" directory
139 DIRECTORY ${PROJECT_SOURCE_DIR}/run/
140 DESTINATION ${CMAKE_INSTALL_PREFIX}/run
141 PATTERN CMakeLists.txt EXCLUDE
142 PATTERN .gitignore EXCLUDE
145 TARGETS ${FOLDER_COMPILE_TARGETS}
146 DEST_PATH ${CMAKE_INSTALL_PREFIX}/run
150 # Re-setup this particular file
153 ${PROJECT_SOURCE_DIR}/phys/noahmp/parameters/MPTABLE.TBL
155 ${CMAKE_INSTALL_PREFIX}/run/