Added
Link Here
|
1 |
--- CMakeLists.txt.orig 2021-02-02 00:24:20 UTC |
2 |
+++ CMakeLists.txt |
3 |
@@ -1,3 +1,4 @@ |
4 |
+ |
5 |
# Copyright 2015 The RE2 Authors. All Rights Reserved. |
6 |
# Use of this source code is governed by a BSD-style |
7 |
# license that can be found in the LICENSE file. |
8 |
@@ -147,12 +148,29 @@ set(RE2_HEADERS |
9 |
re2/stringpiece.h |
10 |
) |
11 |
|
12 |
+macro(extract_version file setting_name) |
13 |
+ file(STRINGS ${file} VERSION_NUMBER REGEX "^${setting_name}") |
14 |
+ string(REPLACE "=" ";" VERSION_NUMBER_LIST ${VERSION_NUMBER}) |
15 |
+ list(GET VERSION_NUMBER_LIST 1 ${setting_name}) |
16 |
+endmacro(extract_version) |
17 |
+ |
18 |
+extract_version(Makefile SONAME) |
19 |
+ |
20 |
+set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) |
21 |
+set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) |
22 |
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/re2.pc ${CMAKE_CURRENT_BINARY_DIR}/re2.pc @ONLY) |
23 |
+ |
24 |
install(FILES ${RE2_HEADERS} |
25 |
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/re2) |
26 |
-install(TARGETS re2 EXPORT re2Config |
27 |
+install(TARGETS re2 EXPORT re2-config |
28 |
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} |
29 |
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} |
30 |
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} |
31 |
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) |
32 |
-install(EXPORT re2Config |
33 |
+install(EXPORT re2-config |
34 |
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/re2 NAMESPACE re2::) |
35 |
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/re2.pc |
36 |
+ DESTINATION ${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig) |
37 |
+ADD_CUSTOM_TARGET(install_files ALL |
38 |
+ COMMAND ${CMAKE_COMMAND} -E create_symlink libre2.so libre2.so.${SONAME} |
39 |
+ COMMAND ${CMAKE_COMMAND} -E create_symlink libre2.so libre2.so.${SONAME}.0.0) |