Fix header file installation paths to respect CMAKE_INSTALL_INCLUDEDIR

Previously, header files were installed uniformly under the include directory, ignoring the specified paths.
This change ensures header files are installed in the appropriate directories under `CMAKE_INSTALL_INCLUDEDIR`.
This commit is contained in:
otegami 2024-05-08 21:01:53 +08:00
parent a5c8a2c845
commit 724d1aad39

View File

@ -271,12 +271,14 @@ INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-c-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
) )
FOREACH (file ${msgpack-c_common_HEADERS}) FOREACH (file ${msgpack-c_common_HEADERS})
GET_FILENAME_COMPONENT (dir ${file} PATH) GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
INSTALL (FILES ${file} DESTINATION ${dir}) STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir})
INSTALL (FILES ${file} DESTINATION ${header_path})
ENDFOREACH () ENDFOREACH ()
FOREACH (file ${msgpack-c_configured_HEADERS}) FOREACH (file ${msgpack-c_configured_HEADERS})
GET_FILENAME_COMPONENT (dir ${file} PATH) GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${dir}) STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir})
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${header_path})
ENDFOREACH () ENDFOREACH ()
IF (NOT MSVC) IF (NOT MSVC)
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)