vcpkg/ports/libredwg/fix_install.patch
MonicaLiu 72d66da23b
[libredwg] Fix the usage error and cleanup patch (#36912)
Fixes #36889.

* Fix usage error:
```
C:\source\repos\CMakeUsage\CMakeUsage\CMakeUsage.cpp(2,10): error C1083: Cannot open include file: 'libredwg/dwg.h': No such file or directory 
```

* Cleanup redundant patches: `fix_arm64_build.patch`.

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] ~The "supports" clause reflects platforms that may be fixed by
this new version.~
- [ ] ~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~
- [ ] ~Any patches that are no longer applied are deleted from the
port's directory.~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.

All features are tested successfully in the following triplet:
```
x86-windows
x64-windows
x64-windows-static
```

The usage test passed on `x64-windows` (header files found):
```
libredwg provides CMake targets:

    find_package(unofficial-libredwg CONFIG REQUIRED)
    target_link_libraries(main unofficial::libredwg::libredwg)
```

---------

Co-authored-by: Monica <v-liumonica@microsoft.com>
2024-02-21 22:49:26 -08:00

46 lines
1.4 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index cbf9341..2e854f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,7 +279,8 @@ target_include_directories(${redwg} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}/src)
target_include_directories(${redwg} PUBLIC
- ${CMAKE_CURRENT_SOURCE_DIR}/include)
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<INSTALL_INTERFACE:include>)
link_libraries(${redwg} ${LIBS} ${CMAKE_THREAD_LIBS_INIT})
@@ -390,6 +391,7 @@ add_custom_target(
DEPENDS ${SRCS}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
+if(0)
if(MSVC)
install(TARGETS ${redwg} RUNTIME PUBLIC_HEADER
DESTINATION libredwg-${PACKAGE_VERSION})
@@ -411,6 +413,22 @@ else()
endif()
endif()
install(TARGETS RUNTIME)
+endif()
+
+include(GNUInstallDirs)
+install(
+ TARGETS ${redwg}
+ EXPORT libredwg-core
+ COMPONENT libredwg
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ PUBLIC_HEADER DESTINATION include/libredwg)
+if(NOT LIBREDWG_LIBONLY)
+ install(TARGETS ${executables_TARGETS}
+ DESTINATION "${CMAKE_INSTALL_BINDIR}")
+endif()
+install(EXPORT libredwg-core FILE unofficial-libredwg-config.cmake NAMESPACE unofficial::libredwg:: DESTINATION share/unofficial-libredwg)
if(WIN32)
add_custom_target(dist