-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: fix cmake DESTDIR support #85
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @davvid, I've finally been able to get around to testing this pull request. I ran into a few issues below. Thanks for your patience!
cmake/macros/Public.cmake
Outdated
@@ -885,12 +889,18 @@ function(pxr_setup_plugins) | |||
# top-level plugin area | |||
_get_resources_dir_name(resourcesDir) | |||
set(plugInfoContents "{\\n \\\"Includes\\\": [ \\\"*/${resourcesDir}/\\\" ]\\n}\\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we're not passing this variable through an install(CODE ...) block, I think the double-escaping needs to be removed, e.g.
set(plugInfoContents "{\n \"Includes\": [ \"*/${resourcesDir}/\" ]\n}\n")
cmake/macros/Public.cmake
Outdated
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/plugins_plugInfo.json" | ||
"${plugInfoContents}") | ||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/plugins_plugInfo.json" | ||
DESTINATION "${SHARE_INSTALL_PREFIX}/plugins/plugInfo.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a typo here, as the CMake docs say the DESTINATION parameter is a directory name. Without this fix, the plugInfo.json file gets installed into the wrong place which breaks stuff at runtime.
DESTINATION "${SHARE_INSTALL_PREFIX}/plugins"
We were emitting cmake code that was attempting to write directly into the installation prefix. This breaks when building using DESTDIR because we are writing directly into the prefix without taking the DESTDIR into account. This breaks this common use case: make DESTDIR=/usr install Fix the build by writing the generated files into the cmake binary directory and then using a normal install(...) command to install them. This lets cmake handle the pathing, and thus DESTDIR will be correctly handled. Closes PixarAnimationStudios#84 Signed-off-by: David Aguilar <[email protected]>
Thanks for the careful review @sunyab . I've updated |
build: fix cmake DESTDIR support
(cherry picked from commit 69dded842503e9d122d301131210db7061a45352)
Fix issue #84 by generating files and installing them in separate steps.