Skip to content

Allow use of box2d from build directory - #986

Open
madebr wants to merge 2 commits into
erincatto:mainfrom
madebr:support-find_package-from-build-directory
Open

Allow use of box2d from build directory#986
madebr wants to merge 2 commits into
erincatto:mainfrom
madebr:support-find_package-from-build-directory

Conversation

@madebr

@madebr madebr commented Sep 25, 2025

Copy link
Copy Markdown

This makes is possible to do find_package(box2d) in your user program by etting the CMake variables box2d_DIR or CMAKE_PREFIX_PATH to the build directory.

This change allows me to build box2d once, and use it without having to install it somewhere, allowing faster iterations.

This makes is possible to do find_package(box2d) in your user program
by etting the CMake variables box2d_DIR or CMAKE_PREFIX_PATH to
the build directory.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables consuming Box2D directly from its CMake build tree (without installation) by generating a build-directory box2dConfig.cmake and colocating the package version file where find_package(box2d) can resolve it when box2d_DIR is set to the build directory.

Changes:

  • Add a build-tree export(EXPORT ...) to emit box2dConfig.cmake into ${PROJECT_BINARY_DIR}.
  • Move box2dConfigVersion.cmake generation and installation source path from ${CMAKE_CURRENT_BINARY_DIR} to ${PROJECT_BINARY_DIR}.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants