Skip to content
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

Merged
merged 1 commit into from
Mar 17, 2017

Conversation

davvid
Copy link
Contributor

@davvid davvid commented Oct 18, 2016

Fix issue #84 by generating files and installing them in separate steps.

@davvid davvid changed the base branch from master to dev October 19, 2016 04:43
Copy link
Contributor

@sunyab sunyab left a 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!

@@ -885,12 +889,18 @@ function(pxr_setup_plugins)
# top-level plugin area
_get_resources_dir_name(resourcesDir)
set(plugInfoContents "{\\n \\\"Includes\\\": [ \\\"*/${resourcesDir}/\\\" ]\\n}\\n")
Copy link
Contributor

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")

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"
Copy link
Contributor

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]>
@davvid
Copy link
Contributor Author

davvid commented Mar 14, 2017

Thanks for the careful review @sunyab . I've updated davvid/cmake-destdir with your review notes, it should be correct now. DESTINATION is now correctly specified as a directory and the double-escaping was removed. I also rebased to the latest dev branch.

@pixar-oss pixar-oss merged commit 4d6d011 into PixarAnimationStudios:dev Mar 17, 2017
pixar-oss added a commit that referenced this pull request Mar 17, 2017
build: fix cmake DESTDIR support
AdamFelt pushed a commit to autodesk-forks/USD that referenced this pull request Apr 16, 2024
(cherry picked from commit 69dded842503e9d122d301131210db7061a45352)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants