/[lmdze]/trunk/dyn3d/CMakeLists.txt
ViewVC logotype

Contents of /trunk/dyn3d/CMakeLists.txt

Parent Directory Parent Directory | Revision Log Revision Log


Revision 351 - (show annotations)
Tue Jan 7 11:59:00 2020 UTC (4 years, 4 months ago) by guez
File MIME type: text/plain
File size: 749 byte(s)
Simplify `CMakeLists.txt` files

Take advantage of improved building of libraries: use `find_package`
instead of `find_path` and `find_library`.

Link each executable to target `LMDZE_objects` instead of including the
corresponding objects in the definition of the target executable. This
way, the executable inherits the dependencies of `LMDZE_objects` and
we do not need them in `library_list`.

Remove the definition of `library_list`. Replace the reference to
`library_list` by references to just `netcdff_LIBRARY` and `NetCDF_LIBRARY`.

1 file(STRINGS ${CMAKE_CURRENT_LIST_DIR}/file_list file_list_var)
2 list(TRANSFORM file_list_var PREPEND ${CMAKE_CURRENT_LIST_DIR}/)
3 target_sources(LMDZE_objects PRIVATE ${file_list_var})
4
5 foreach(my_dir Guide Dissipation Inter_barxy Vlsplt ADVN)
6 include(${CMAKE_CURRENT_LIST_DIR}/${my_dir}/CMakeLists.txt)
7 endforeach(my_dir)
8
9 add_executable(gcm ${CMAKE_CURRENT_LIST_DIR}/gcm.f90)
10 target_link_libraries(gcm LMDZE_objects ${netcdff_LIBRARY} ${NetCDF_LIBRARY})
11
12 add_executable(test_fxhyp ${CMAKE_CURRENT_LIST_DIR}/test_fxhyp.f90)
13 target_link_libraries(test_fxhyp LMDZE_objects ${netcdff_LIBRARY}
14 ${NetCDF_LIBRARY})
15
16 add_executable(ce0l ${CMAKE_CURRENT_LIST_DIR}/ce0l.f90)
17 target_link_libraries(ce0l LMDZE_objects ${netcdff_LIBRARY} ${NetCDF_LIBRARY})

  ViewVC Help
Powered by ViewVC 1.1.21