1
2# Macros cmake's CONFIGURE_PACKAGE_CONFIG_FILE() would create
3
4macro(set_and_check _var _file)
5set(${_var} "${_file}")
6if(NOT EXISTS "${_file}")
7  message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
8  endif()
9  endmacro()
10
11  macro(check_required_components _NAME)
12  foreach(comp ${${_NAME}_FIND_COMPONENTS})
13    if(NOT ${_NAME}_${comp}_FOUND)
14        if(${_NAME}_FIND_REQUIRED_${comp})
15        set(${_NAME}_FOUND FALSE)
16        endif()
17    endif()
18  endforeach()
19endmacro()
20
21include(CMakeFindDependencyMacro)
22find_dependency(gwengui-cpp "@GWENHYWFAR_VERSION_STRING@")
23find_dependency(Qt5Core)
24find_dependency(Qt5Widgets)
25
26
27set_and_check(prefix "@prefix@")
28set_and_check(exec_prefix "@exec_prefix@")
29set_and_check(includedir "@includedir@")
30set_and_check(${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS "@gwenhywfar_headerdir@")
31if(WIN32)
32    set_and_check(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES "@libdir@/libgwengui-qt5.dll.a")
33elseif(APPLE)
34    set_and_check(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES "@libdir@/libgwengui-qt5.dylib")
35else()
36    set_and_check(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES "@libdir@/libgwengui-qt5.so")
37endif()
38
39set(${CMAKE_FIND_PACKAGE_NAME}_FOUND true)
40
41if(NOT TARGET gwenhywfar::gui-qt5)
42  add_library(gwenhywfar::gui-qt5 UNKNOWN IMPORTED)
43  set_target_properties(gwenhywfar::gui-qt5 PROPERTIES
44    IMPORTED_LOCATION "${${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES}"
45    INTERFACE_INCLUDE_DIRECTORIES "${${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS}"
46    INTERFACE_LINK_LIBRARIES "gwenhywfar::core;gwenhywfar::gui-cpp;Qt5::Core;Qt5::Widgets"
47  )
48endif()
49
50set(${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES "${${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES};gwenhywfar::core;gwenhywfar::gui-cpp")
51mark_as_advanced( ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS ${CMAKE_FIND_PACKAGE_NAME}_LIBRARIES ${CMAKE_FIND_PACKAGE_NAME}_INCLUDE_DIRS)
52