mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-18 16:47:50 +08:00
65 lines
2.3 KiB
Diff
65 lines
2.3 KiB
Diff
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 767d808..21f0cfc 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -74,14 +74,42 @@ if (NOT WIN32) # If on windows, do not build binaries that do not support window
|
||
|
target_link_libraries(edlib-aligner edlib)
|
||
|
endif()
|
||
|
|
||
|
-
|
||
|
-# Create target 'install' for installing libraries.
|
||
|
-install(TARGETS edlib DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
-install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||
|
-
|
||
|
# configure and install pkg-config file
|
||
|
configure_file(
|
||
|
${CMAKE_CURRENT_SOURCE_DIR}/edlib.pc.in
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc
|
||
|
@ONLY)
|
||
|
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/edlib-1.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||
|
+
|
||
|
+### Additional config for VCPKG
|
||
|
+include(CMakePackageConfigHelpers)
|
||
|
+set(EDLIB_CMAKE_DIR "lib/cmake/edlib" CACHE STRING
|
||
|
+ "Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
|
||
|
+set(version_config "${PROJECT_BINARY_DIR}/edlib-config-version.cmake")
|
||
|
+set(project_config "${PROJECT_BINARY_DIR}/edlib-config.cmake")
|
||
|
+set(targets_export_name edlib-targets)
|
||
|
+
|
||
|
+# Generate the version, config and target files into the build directory.
|
||
|
+write_basic_package_version_file(
|
||
|
+ ${version_config}
|
||
|
+ VERSION ${VERSION}
|
||
|
+ COMPATIBILITY AnyNewerVersion)
|
||
|
+configure_package_config_file(
|
||
|
+ ${PROJECT_SOURCE_DIR}/edlib-config.cmake.in
|
||
|
+ ${project_config}
|
||
|
+ INSTALL_DESTINATION ${EDLIB_CMAKE_DIR})
|
||
|
+export(TARGETS edlib NAMESPACE edlib::
|
||
|
+ FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
|
||
|
+
|
||
|
+# Install version, config and target files.
|
||
|
+install(
|
||
|
+ FILES ${project_config} ${version_config}
|
||
|
+ DESTINATION ${EDLIB_CMAKE_DIR})
|
||
|
+install(EXPORT ${targets_export_name} DESTINATION ${EDLIB_CMAKE_DIR}
|
||
|
+ NAMESPACE edlib::)
|
||
|
+
|
||
|
+### //
|
||
|
+
|
||
|
+# Create target 'install' for installing libraries.
|
||
|
+install(TARGETS edlib EXPORT ${targets_export_name} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||
|
+install(FILES edlib/include/edlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||
|
\ No newline at end of file
|
||
|
diff --git a/edlib-config.cmake.in b/edlib-config.cmake.in
|
||
|
new file mode 100644
|
||
|
index 0000000..f2cc030
|
||
|
--- /dev/null
|
||
|
+++ b/edlib-config.cmake.in
|
||
|
@@ -0,0 +1,4 @@
|
||
|
+@PACKAGE_INIT@
|
||
|
+
|
||
|
+include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
|
||
|
+check_required_components(edlib)
|
||
|
\ No newline at end of file
|