File: GeneratePkgConfig.cmake

package info (click to toggle)
mlpack 4.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 31,272 kB
  • sloc: cpp: 226,039; python: 1,934; sh: 1,198; lisp: 414; makefile: 85
file content (28 lines) | stat: -rw-r--r-- 1,139 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
# As input the following variables should be set:
#
#   MLPACK_SOURCE_DIR: directory containing mlpack sources.
#
# And our goal in this file is to generate/configure mlpack.pc.

# First, we need to extract the version string.
if (NOT EXISTS "${MLPACK_SOURCE_DIR}/src/mlpack/core/util/version.hpp")
  message(FATAL_ERROR "Cannot open "
      "${MLPACK_SOURCE_DIR}/src/mlpack/core/util/version.hpp to extract "
      "version!")
endif ()

file(READ "${MLPACK_SOURCE_DIR}/src/mlpack/core/util/version.hpp"
    VERSION_HPP_CONTENTS)
string(REGEX REPLACE ".*#define MLPACK_VERSION_MAJOR ([0-9]+).*" "\\1"
    MLPACK_VERSION_MAJOR "${VERSION_HPP_CONTENTS}")
string(REGEX REPLACE ".*#define MLPACK_VERSION_MINOR ([0-9]+).*" "\\1"
    MLPACK_VERSION_MINOR "${VERSION_HPP_CONTENTS}")
string(REGEX REPLACE ".*#define MLPACK_VERSION_PATCH [\"]?([0-9x]+)[\"]?.*" "\\1"
    MLPACK_VERSION_PATCH "${VERSION_HPP_CONTENTS}")

set(MLPACK_VERSION_STRING
    "${MLPACK_VERSION_MAJOR}.${MLPACK_VERSION_MINOR}.${MLPACK_VERSION_PATCH}")

configure_file(
    ${CMAKE_BINARY_DIR}/CMake/mlpack.pc.in.partial
    ${CMAKE_BINARY_DIR}/lib/pkgconfig/mlpack.pc @ONLY)