diy-config.cmake
Go to the documentation of this file.
1 if (CMAKE_VERSION VERSION_LESS "3.9")
2  message(FATAL_ERROR "Diy requires CMake 3.9+")
3 endif()
4 
5 
6 ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
7 ####### Any changes to this file will be overwritten by the next CMake run ####
8 ####### The input file was diy-config.cmake.in ########
9 
10 get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/" ABSOLUTE)
11 
12 macro(set_and_check _var _file)
13  set(${_var} "${_file}")
14  if(NOT EXISTS "${_file}")
15  message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
16  endif()
17 endmacro()
18 
20  foreach(comp ${${_NAME}_FIND_COMPONENTS})
21  if(NOT ${_NAME}_${comp}_FOUND)
22  if(${_NAME}_FIND_REQUIRED_${comp})
23  set(${_NAME}_FOUND FALSE)
24  endif()
25  endif()
26  endforeach()
27 endmacro()
28 
29 ####################################################################################
30 
31 set(threads "OFF")
32 set(log "OFF")
33 set(caliper "OFF")
34 set(mpi "OFF")
35 
36 include("${CMAKE_CURRENT_LIST_DIR}/diy-targets.cmake")
37 
38 set(_diy_find_quietly)
39 if (${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
40  set(_diy_find_quietly QUIET)
41 endif()
42 
43 if (threads)
44  find_package(Threads ${_diy_find_quietly})
45  if (NOT Threads_FOUND)
46  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "Threads not found")
47  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
48  endif()
49 endif()
50 
51 if (log)
52  find_package(spdlog ${_diy_find_quietly})
53  if (NOT spdlog_FOUND)
54  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "SPDLOG not found")
55  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
56  endif()
57 endif()
58 
59 if (caliper)
60  find_package(caliper ${_diy_find_quietly})
61  if (NOT caliper_FOUND)
62  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "Caliper not found")
63  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
64  else()
65  target_include_directories(DIY::vtkmdiy INTERFACE $<INSTALL_INTERFACE:${caliper_INCLUDE_DIR}>)
66  endif()
67 endif()
68 
69 if (mpi)
70  find_package(MPI ${_diy_find_quietly})
71  if (NOT MPI_FOUND)
72  list(APPEND "${CMAKE_FIND_PACKAGE_NAME}_NOT_FOUND_MESSAGE" "MPI not found")
73  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 0)
74  endif()
75 endif()
76 
77 if (NOT DEFINED "${CMAKE_FIND_PACKAGE_NAME}_FOUND")
78  set("${CMAKE_FIND_PACKAGE_NAME}_FOUND" 1)
79 endif ()
macro check_required_components(_NAME)
macro set_and_check(_var, _file)