Repository navigation
Closed
Description
In my rpm package with msgpack I've added the patch to use cmake GNUInstallDirs module.
--- a/CMakeLists.txt~ 2021-09-01 03:10:58.000000000 +0100
+++ b/CMakeLists.txt 2021-09-13 14:35:52.335447925 +0100
@@ -7,6 +7,8 @@
PROJECT (msgpack)
+include(GNUInstallDirs)
+
FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/version_master.h contents)
STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents})
SET (VERSION_MAJOR ${CMAKE_MATCH_1})
@@ -19,8 +21,8 @@
LIST (APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/")
SET (prefix ${CMAKE_INSTALL_PREFIX})
SET (exec_prefix "\${prefix}")
-SET (libdir "\${exec_prefix}/lib")
-SET (includedir "\${prefix}/include")
+SET (libdir "\${prefix}/${CMAKE_INSTALL_LIBDIR}")
+SET (includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
OPTION (MSGPACK_32BIT "32bit compile" OFF)
@@ -52,9 +54,9 @@
SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
- LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
+ LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_LIBDIR}" isSystemDir)
IF ("${isSystemDir}" STREQUAL "-1")
- SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
+ SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}")
ENDIF ()
ENDIF ()
@@ -234,14 +236,6 @@
SET (CMAKE_C_FLAGS "-DMSGPACK_ZONE_ALIGN=8 ${CMAKE_C_FLAGS}")
ENDIF ()
-IF (NOT DEFINED CMAKE_INSTALL_BINDIR)
- SET(CMAKE_INSTALL_BINDIR bin)
-ENDIF ()
-
-IF (NOT DEFINED CMAKE_INSTALL_LIBDIR)
- SET(CMAKE_INSTALL_LIBDIR lib)
-ENDIF ()
-
IF (MSGPACK_BUILD_EXAMPLES)
ADD_SUBDIRECTORY (example)
ENDIF ()
@@ -261,11 +255,11 @@
)
FOREACH (file ${msgpackc_common_HEADERS})
GET_FILENAME_COMPONENT (dir ${file} PATH)
- INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
+ INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
ENDFOREACH ()
FOREACH (file ${msgpackc_configured_HEADERS})
GET_FILENAME_COMPONENT (dir ${file} PATH)
- INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
+ INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
ENDFOREACH ()
IF (NOT MSVC)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
Please let me know if you want that patch as PR.
After build and install msgpack with that patch neovim cmake cannot find msgpack and it fails with:
-- Found LibUV: /usr/lib64/libuv.so (Required is at least version "1.28.0")
CMake Error at /usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Msgpack (missing: MSGPACK_INCLUDE_DIR) (Required is at least
version "1.0.0")
Call Stack (most recent call first):
/usr/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
cmake/FindMsgpack.cmake:50 (find_package_handle_standard_args)
CMakeLists.txt:387 (find_package)
-- Configuring incomplete, errors occurred!Metadata
Metadata
Assignees
Labels
No labels
Activity
kloczek commentedon Sep 13, 2021
Just FTR:
redboltz commentedon Sep 13, 2021
I don't know much about
GNUInstallDirs. It this not harmful on non-GNU environment e.g.Windows ?Is conditional include not required?
kloczek commentedon Sep 13, 2021
It is standard cmake module which provides set of GNU standard installation directories.
It is used almost everywhere.
https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
kloczek commentedon Sep 13, 2021
It should be working as well on Win* as well.
redboltz commentedon Sep 13, 2021
Thanks. Please send a pull request.
kloczek commentedon Sep 13, 2021
I see more parts which can be removed because of introduction GNUInstallDirs.
Will try to make PR tomorrow or next day.
Kind of question: did you maybe try to build neovim with msgpack 4.0.0?
redboltz commentedon Sep 13, 2021
Thank you.
No I didn't.
jamessan commentedon Sep 14, 2021
This isn't installed correctly. Only msgpack.h should be directly in /usr/include (or whatever the prefix is). The rest of the C headers should be in /usr/include/msgpack/.
kloczek commentedon Sep 14, 2021
ok will check that at evening :)
redboltz commentedon Feb 13, 2022
I close the issue, if you still interested in the issue, reopen with comment.