File: FindQuaZip.cmake

package info (click to toggle)
librepcb 1.2.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 58,484 kB
  • sloc: cpp: 267,986; python: 12,100; ansic: 6,899; xml: 234; sh: 215; makefile: 115; perl: 73
file content (58 lines) | stat: -rw-r--r-- 1,603 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
set(QUAZIP_SUBMODULE_BASEPATH "${PROJECT_SOURCE_DIR}/libs/quazip")
if(EXISTS "${QUAZIP_SUBMODULE_BASEPATH}"
   AND NOT UNBUNDLE_QUAZIP
   AND NOT UNBUNDLE_ALL
)
  message(STATUS "Using vendored QuaZip")

  # Use same Qt version as for LibrePCB
  set(QUAZIP_QT_MAJOR_VERSION ${QT_MAJOR_VERSION})

  # We don't need bzip2 (do we?)
  set(QUAZIP_BZIP2
      OFF
      CACHE BOOL "" FORCE
  )

  # Use Qt embedded ZLib as this simplifies deployment
  # Note: Doesn't work with Qt6 anymore (at least on Windows).
  if(QT_MAJOR_VERSION EQUAL 5)
    set(QUAZIP_USE_QT_ZLIB
        ON
        CACHE STRING "" FORCE
    )
  endif()

  # We don't need to support installation when using the lib as a submodule
  set(QUAZIP_INSTALL
      OFF
      CACHE BOOL "" FORCE
  )

  # Include local submodule
  add_subdirectory(
    "${QUAZIP_SUBMODULE_BASEPATH}" "${CMAKE_BINARY_DIR}/libs/quazip"
    EXCLUDE_FROM_ALL
  )

  # Stop here, we're done
  return()
endif()

# Otherwise, try to find shared library on the system
#
# NOTE: Due to packaging issues with QuaZip 0.x, we only support QuaZip 1.x
#       when unbundling. Using QuaZip 0.9 should work as well, but then you'll
#       have to patch this find script as well as potentially the include paths
#       (quazip -> quazip5) yourself. Or just use the bundled version. See also:
#       https://github.com/LibrePCB/LibrePCB/pull/798#issuecomment-720167363

find_package(QuaZip-${QT})
if(QuaZip-${QT}_FOUND)
  message(STATUS "Using system QuaZip 1.x")

  # Stop here, we're done
  return()
endif()

message(FATAL_ERROR "Did not find QuaZip 1.x system library")