vcpkg/ports/box2d/export-targets.patch

37 lines
1.4 KiB
Diff
Raw Normal View History

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6ef515f..6975f91 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -95,8 +95,8 @@ set(BOX2D_HEADER_FILES
../include/box2d/b2_world_callbacks.h
../include/box2d/box2d.h)
-add_library(box2d STATIC ${BOX2D_SOURCE_FILES} ${BOX2D_HEADER_FILES})
-target_include_directories(box2d PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../include)
+add_library(box2d STATIC ${BOX2D_SOURCE_FILES})
+target_include_directories(box2d PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
target_include_directories(box2d PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
set_target_properties(box2d PROPERTIES
CXX_STANDARD 11
@@ -104,5 +104,18 @@ set_target_properties(box2d PROPERTIES
CXX_EXTENSIONS NO
)
-source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" PREFIX "src" FILES ${BOX2D_SOURCE_FILES})
-source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/../include" PREFIX "include" FILES ${BOX2D_HEADER_FILES})
+install(FILES ${BOX2D_HEADER_FILES} DESTINATION include/box2d)
+
+install(TARGETS box2d
+ EXPORT unofficial-box2d-targets
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
+
+install(
+ EXPORT unofficial-box2d-targets
+ FILE unofficial-box2d-config.cmake
+ NAMESPACE unofficial::box2d::
+ DESTINATION share/unofficial-box2d
+)