diff --git a/CMakeLists.txt b/CMakeLists.txt index 03d76d8b8..3d8894b40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -271,12 +271,14 @@ INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-c-targets ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) FOREACH (file ${msgpack-c_common_HEADERS}) - GET_FILENAME_COMPONENT (dir ${file} PATH) - INSTALL (FILES ${file} DESTINATION ${dir}) + GET_FILENAME_COMPONENT(dir ${file} DIRECTORY) + STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir}) + INSTALL (FILES ${file} DESTINATION ${header_path}) ENDFOREACH () FOREACH (file ${msgpack-c_configured_HEADERS}) - GET_FILENAME_COMPONENT (dir ${file} PATH) - INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${dir}) + GET_FILENAME_COMPONENT(dir ${file} DIRECTORY) + STRING(REPLACE "include" "${CMAKE_INSTALL_INCLUDEDIR}" header_path ${dir}) + INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${header_path}) ENDFOREACH () IF (NOT MSVC) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)