-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathExternal_libuuid.cmake.in
42 lines (36 loc) · 1.56 KB
/
External_libuuid.cmake.in
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
cmake_minimum_required(VERSION 2.8.2)
project(libuuid-download NONE)
include(ExternalProject)
set(EP_SOURCE_DIR ${CMAKE_BINARY_DIR}/libuuid-src)
set(EP_BINARY_DIR ${CMAKE_BINARY_DIR}/libuuid-src)
set(EP_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
set(libuuid_major_minor 2.32)
set(libuuid_version "${libuuid_major_minor}.1")
set(libuuid_URL "https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v${libuuid_major_minor}/util-linux-${libuuid_version}.tar.gz")
set(libuuid_SHA256 3bbf9f3d4a33d6653cf0f7e4fc422091b6a38c3b1195c0ee716c67148a1a7122)
include(ProcessorCount)
ProcessorCount(CPU_COUNT)
if(CPU_COUNT EQUAL 0)
set(CPU_COUNT 2)
endif()
ExternalProject_Add(libuuid
URL ${libuuid_URL}
URL_HASH SHA256=${libuuid_SHA256}
SOURCE_DIR ${EP_SOURCE_DIR}
BINARY_DIR ${EP_BINARY_DIR}
INSTALL_DIR ${EP_INSTALL_DIR}
CONFIGURE_COMMAND CFLAGS=-fPIC bash configure --disable-all-programs --enable-libuuid
BUILD_COMMAND make -j ${CPU_COUNT}
# On some platforms:
# - If `DESTDIR` is not specified with the install command, libuuid will be
# installed in a system prefix.
# - If `DESTDIR` is specified and `prefix` is not, the makefile inserts a
# `usr` in the library install path.
# - If `DESTDIR` and `prefix` are both set to the installation prefix, the
# header install path is a concatenation of `DESTDIR` and `prefix`,
# repeating the installation prefix.
#
# The solution appears to set `prefix` to an empty string and `DESTDIR` to
# the installation prefix.
INSTALL_COMMAND make install prefix="" DESTDIR=${EP_INSTALL_DIR}
)