Skip to content

Commit 80f6000

Browse files
committed
cmake: Respect --prefix for headers during cmake --install
Removing CMAKE_INSTALL_PREFIX allows for `cmake --install <build-dir> --prefix=<installation-prefix>` to install headers at `<installation-prefix>/include` at install time. When CMAKE_INSTALL_PREFIX is present in `INSTALL()`, it is hard-coded during configuration (e.g., `cmake -S .`), which disallows it from being set at install time.
1 parent 4fd5056 commit 80f6000

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,11 @@ INSTALL (TARGETS ${MSGPACK_INSTALLTARGETS} EXPORT msgpack-c-targets
260260
)
261261
FOREACH (file ${msgpack-c_common_HEADERS})
262262
GET_FILENAME_COMPONENT (dir ${file} PATH)
263-
INSTALL (FILES ${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
263+
INSTALL (FILES ${file} DESTINATION ${dir})
264264
ENDFOREACH ()
265265
FOREACH (file ${msgpack-c_configured_HEADERS})
266266
GET_FILENAME_COMPONENT (dir ${file} PATH)
267-
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${CMAKE_INSTALL_PREFIX}/${dir})
267+
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/${file} DESTINATION ${dir})
268268
ENDFOREACH ()
269269
IF (NOT MSVC)
270270
INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/msgpack-c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

0 commit comments

Comments
 (0)