Skip to content

Commit 724d1aa

Browse files
committed
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`.
1 parent a5c8a2c commit 724d1aa

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

CMakeLists.txt

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,14 @@ INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-c-targets
271271
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
272272
)
273273
FOREACH (file ${msgpack-c_common_HEADERS})
274-
GET_FILENAME_COMPONENT (dir ${file} PATH)
275-
INSTALL (FILES ${file} DESTINATION ${dir})
274+
GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
275+
STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir})
276+
INSTALL (FILES ${file} DESTINATION ${header_path})
276277
ENDFOREACH ()
277278
FOREACH (file ${msgpack-c_configured_HEADERS})
278-
GET_FILENAME_COMPONENT (dir ${file} PATH)
279-
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${dir})
279+
GET_FILENAME_COMPONENT(dir ${file} DIRECTORY)
280+
STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir})
281+
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${header_path})
280282
ENDFOREACH ()
281283
IF (NOT MSVC)
282284
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

0 commit comments

Comments
 (0)