Debian Codegraph @

CMakeLists.txt

raw
1 cmake_minimum_required (VERSION 3.12)
2
3 list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
4
5 set (FREI0R_VERSION "3.0.0" CACHE STRING "Project version in SemVer format")
6 if (DEFINED ENV{FREI0R_VERSION} AND NOT "$ENV{FREI0R_VERSION}" STREQUAL "")
7 set (FREI0R_VERSION "$ENV{FREI0R_VERSION}")
8 endif ()
9 string (REGEX REPLACE "^v" "" FREI0R_VERSION "${FREI0R_VERSION}")
10 if (NOT FREI0R_VERSION MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
11 message (FATAL_ERROR "FREI0R_VERSION must be a SemVer string like 3.0.0")
12 endif ()
13
14 project (frei0r VERSION ${FREI0R_VERSION})
15 set (CMAKE_CXX_STANDARD 11)
16 set (CMAKE_CXX_STANDARD_REQUIRED True)
17
18 include(GNUInstallDirs)
19
20 set(CMAKE_CTEST_ARGUMENTS "--verbose")
21 include(CTest)
22
23 option (WITHOUT_OPENCV "Disable plugins dependent upon OpenCV" OFF)
24 option (WITHOUT_FACERECOGNITION "Disable facedetect plugin to avoid protobuf conflicts" OFF)
25
26 if (NOT WITHOUT_OPENCV)
27 find_package (OpenCV REQUIRED)
28 endif ()
29
30 option (WITHOUT_CAIRO "Disable plugins dependent upon Cairo" OFF)
31 if (NOT WITHOUT_CAIRO)
32 find_package (Cairo REQUIRED)
33 endif ()
34
35 include(FindPkgConfig)
36 option (WITHOUT_GAVL "Disable plugins dependent upon gavl" OFF)
37 if (PKG_CONFIG_FOUND AND NOT WITHOUT_GAVL)
38 pkg_check_modules(GAVL REQUIRED gavl)
39 endif ()
40
41 include_directories (AFTER include)
42
43 if (NOT CMAKE_BUILD_TYPE)
44 set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
45 "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
46 FORCE)
47 endif (NOT CMAKE_BUILD_TYPE)
48
49 set (LIBDIR "${CMAKE_INSTALL_LIBDIR}/frei0r-1")
50 set (FREI0R_DEF "${CMAKE_SOURCE_DIR}/msvc/frei0r_1_0.def")
51 set (FREI0R_1_1_DEF "${CMAKE_SOURCE_DIR}/msvc/frei0r_1_1.def")
52 set (FREI0R_1_2_DEF "${CMAKE_SOURCE_DIR}/msvc/frei0r_1_2.def")
53
54 # --- custom targets: ---
55 INCLUDE( cmake/modules/TargetDistclean.cmake OPTIONAL)
56
57 install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
58
59 # For code documentation run: doxygen doc/Doxyfile
60 # add_subdirectory (doc)
61
62 add_subdirectory (src)
63 if (BUILD_TESTING)
64 add_subdirectory (test)
65 endif ()
66
67 # Generate frei0r.pc and install it.
68 set (prefix "${CMAKE_INSTALL_PREFIX}")
69 set (exec_prefix "${CMAKE_INSTALL_PREFIX}")
70 set (libdir "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
71 set (includedir "${CMAKE_INSTALL_PREFIX}/include")
72 configure_file ("frei0r.pc.in" "frei0r.pc" @ONLY)
73 install (FILES "${CMAKE_CURRENT_BINARY_DIR}/frei0r.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")