v0.14.0
Tutorials.cmake
Go to the documentation of this file.
1 function(tutorials_copy_and_install extension file_permissions)
2 
3  get_filename_component(TUTORIALS_MOD_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
4 
5  file(GLOB files ${CMAKE_CURRENT_SOURCE_DIR}/${extension})
6  foreach(file ${files})
7  file(
8  COPY ${file}
9  DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/${TUTORIALS_MOD_DIR}
10  FILE_PERMISSIONS ${file_permissions})
11  install(FILES ${file}
12  DESTINATION ${CMAKE_INSTALL_PREFIX}/${TUTORIALS_MOD_DIR}
13  PERMISSIONS ${file_permissions})
14  endforeach(file)
15 endfunction()
16 
17 function(tutorials_add_executable target source)
18  if(MoFEM_PRECOMPILED_HEADRES)
19  set_source_files_properties(${source}
20  PROPERTIES COMPILE_FLAGS "-include ${PERCOMPILED_HEADER}")
21  endif(MoFEM_PRECOMPILED_HEADRES)
22  add_executable(${target} ${source})
23 endfunction(tutorials_add_executable)
24 
25 function(tutorials_install tutorials_mod_dir)
26 
27  get_filename_component(TUTORIALS_MOD_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
28 
29  install(
30  DIRECTORY
31  ${CMAKE_CURRENT_SOURCE_DIR}
32  DESTINATION
33  ${CMAKE_INSTALL_PREFIX}/${TUTORIALS_MOD_DIR}
34  FILES_MATCHING
35  PATTERN "README"
36  PATTERN "*.h5m"
37  PATTERN "*.cub"
38  PATTERN "*.jou"
39  PATTERN "*.msh"
40  PATTERN "*.cfg"
41  PATTERN "*.geo"
42  PATTERN "src" EXCLUDE
43  PATTERN "doc" EXCLUDE
44  PATTERN "atom_tests" EXCLUDE)
45 endfunction(tutorials_install)
46 
47 function(tutorials_build_and_install target source)
48  tutorials_add_executable(${target} ${source})
49 
50  get_filename_component(TUTORIALS_MOD_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME)
51 
52  target_link_libraries(${target}
53  # users_modules
54  mofem_finite_elements
55  mofem_interfaces
56  mofem_multi_indices
57  mofem_petsc
58  mofem_approx
59  mofem_third_party
60  mofem_matrix_function
61  mofem_post_proc
62  mofem_boundary_conditions
63  ${MoFEM_PROJECT_LIBS})
64  install(TARGETS ${target}
65  DESTINATION ${CMAKE_INSTALL_PREFIX}/${TUTORIALS_MOD_DIR})
66 
67 endfunction(tutorials_build_and_install)
68 
69 set(MPI_RUN ${MoFEM_MPI_RUN})