blob: e1af7190aac52a184e14c9e3c8157dfbe028fac8 (
plain)
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
|
#
# Copyright 2015-2016 National Instruments Corp.
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
# We need this to be macro because GET_DIRECTORY_PROPERTY works with
# the current directory.
#
macro(UHD_LOAD_BUILD_INFO)
message(STATUS "")
message(STATUS "Loading build info.")
# Build date
if(IGNORE_BUILD_DATE)
set(UHD_BUILD_DATE "")
elseif(DEFINED ENV{SOURCE_DATE_EPOCH})
EXECUTE_PROCESS(COMMAND ${PYTHON_EXECUTABLE} -c
"import time; print(time.strftime('%a, %d %b %Y %H:%M:%S UTC', time.gmtime($ENV{SOURCE_DATE_EPOCH})))"
OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
"import time; print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
OUTPUT_VARIABLE UHD_BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif(IGNORE_BUILD_DATE)
# Compiler name
if(MSVC)
if(MSVC10)
set(UHD_C_COMPILER "MSVC 2010")
set(UHD_CXX_COMPILER "MSVC 2010")
elseif(MSVC11)
set(UHD_C_COMPILER "MSVC 2012")
set(UHD_CXX_COMPILER "MSVC 2012")
elseif(MSVC12)
set(UHD_C_COMPILER "MSVC 2013")
set(UHD_CXX_COMPILER "MSVC 2013")
elseif(MSVC14)
set(UHD_C_COMPILER "MSVC 2015")
set(UHD_CXX_COMPILER "MSVC 2015")
else()
# Go with the ugly string
set(UHD_C_COMPILER "MSVC ${CMAKE_C_COMPILER_VERSION}")
set(UHD_CXX_COMPILER "MSVC ${CMAKE_CXX_COMPILER_VERSION}")
endif(MSVC10)
else()
set(UHD_C_COMPILER "${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION}")
set(UHD_CXX_COMPILER "${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
endif(MSVC)
# Compiler flags
get_directory_property(uhd_flags COMPILE_DEFINITIONS)
set(UHD_C_FLAGS "${uhd_flags}${CMAKE_C_FLAGS}") # CMAKE_C_FLAGS starts with a space
set(UHD_CXX_FLAGS "${uhd_flags}${CMAKE_CXX_FLAGS}") # CMAKE_CXX_FLAGS starts with a space
endmacro(UHD_LOAD_BUILD_INFO)
|