blob: 6f43edb5c388fe8f05f1833369ffe2ea5a2625d5 (
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
59
60
61
62
|
################################################################################
# ProjUtilities.cmake - part of CMake configuration of PROJ library
#
# Based on BoostUtilities.cmake from CMake configuration for Boost
################################################################################
# Copyright (C) 2007 Douglas Gregor <doug.gregor@gmail.com>
# Copyright (C) 2007 Troy Straszheim
# Copyright (C) 2010 Mateusz Loskot <mateusz@loskot.net>
#
# Distributed under the Boost Software License, Version 1.0.
# See accompanying file LICENSE_1_0.txt or copy at
# https://www.boost.org/LICENSE_1_0.txt
################################################################################
# Macros in this module:
#
# print_variable
# proj_target_output_name:
#
################################################################################
#
# pretty-prints the value of a variable so that the
# equals signs align
#
function(print_variable NAME)
string(LENGTH "${NAME}" varlen)
math(EXPR padding_len 30-${varlen})
if(${padding_len} GREATER 0)
string(SUBSTRING " "
0 ${padding_len} varpadding)
endif()
message(STATUS "${NAME}${varpadding} = ${${NAME}}")
endfunction()
#
# Generates output name for given target depending on platform and version.
# For instance, on Windows, dynamic link libraries get ABI version suffix
# proj_X_Y.dll.
#
function(proj_target_output_name TARGET_NAME OUTPUT_NAME)
if(NOT DEFINED TARGET_NAME)
message(SEND_ERROR "Error, the variable TARGET_NAME is not defined!")
endif()
if(NOT DEFINED ${PROJECT_NAME}_VERSION)
message(SEND_ERROR
"Error, the variable ${${PROJECT_NAME}_VERSION} is not defined!")
endif()
# On Windows, ABI version is specified using binary file name suffix.
# On Unix, suffix is empty and SOVERSION is used instead.
if(WIN32)
string(LENGTH "${${PROJECT_NAME}_ABI_VERSION}" abilen)
if(abilen GREATER 0)
set(SUFFIX "_${${PROJECT_NAME}_ABI_VERSION}")
endif()
endif()
set(${OUTPUT_NAME} ${TARGET_NAME}${SUFFIX} PARENT_SCOPE)
endfunction()
|