Skip to content

Commit 27e8a16

Browse files
cmake: fix installation directories and also install pkgconfig file (#224)
1 parent 8a4cd4c commit 27e8a16

File tree

2 files changed

+23
-12
lines changed

2 files changed

+23
-12
lines changed

CMakeLists.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
cmake_minimum_required (VERSION 2.8.12)
1+
cmake_minimum_required (VERSION 3.0.0)
22

33
include (utils.cmake)
44

55
disallow_intree_builds()
66

7-
project (utf8proc C)
7+
if (POLICY CMP0048)
8+
cmake_policy (SET CMP0048 NEW)
9+
endif ()
10+
project (utf8proc VERSION 2.6.1 LANGUAGES C)
811

912
# This is the ABI version number, which may differ from the
1013
# API version number (defined in utf8proc.h).
@@ -52,16 +55,14 @@ set_target_properties (utf8proc PROPERTIES
5255

5356
if (UTF8PROC_INSTALL)
5457
include(GNUInstallDirs)
55-
mark_as_advanced(CLEAR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
58+
install(FILES utf8proc.h DESTINATION "${CMAKE_INSTALL_FULL_INCLUDEDIR}")
5659
install(TARGETS utf8proc
57-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
58-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX}
59-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}${INSTALL_SUFFIX})
60-
61-
install(
62-
FILES
63-
"${PROJECT_SOURCE_DIR}/utf8proc.h"
64-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}${INSTALL_SUFFIX})
60+
ARCHIVE DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
61+
LIBRARY DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}"
62+
RUNTIME DESTINATION "${CMAKE_INSTALL_FULL_BINDIR}"
63+
)
64+
configure_file(libutf8proc.pc.cmakein libutf8proc.pc @ONLY)
65+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libutf8proc.pc" DESTINATION "${CMAKE_INSTALL_FULL_LIBDIR}/pkgconfig")
6566
endif()
6667

6768
if(UTF8PROC_ENABLE_TESTING)
@@ -101,7 +102,7 @@ if(UTF8PROC_ENABLE_TESTING)
101102
target_link_libraries(normtest utf8proc)
102103
add_test(utf8proc.testgraphemetest graphemetest data/GraphemeBreakTest.txt)
103104
add_test(utf8proc.testnormtest normtest data/NormalizationTest.txt)
104-
105+
105106
if(LIB_FUZZING_ENGINE)
106107
add_executable(fuzzer utf8proc.h test/fuzzer.c)
107108
target_link_libraries(fuzzer ${LIB_FUZZING_ENGINE} utf8proc)

libutf8proc.pc.cmakein

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
prefix=@CMAKE_INSTALL_PREFIX@
2+
exec_prefix=@CMAKE_INSTALL_FULL_BINDIR@
3+
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
4+
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
5+
6+
Name: libutf8proc
7+
Description: UTF8 processing
8+
Version: @PROJECT_VERSION@
9+
Libs: -L${libdir} -lutf8proc
10+
Cflags: -I${includedir} -DUTF8PROC_EXPORTS

0 commit comments

Comments
 (0)