vcpkg/ports/cpuinfo/fix-install.patch
Park DongHa 4ef97c2c33
[cpuinfo,fbgemm,nnpack] update to latest source version and rename targets (#17063)
* [cpuinfo] update to latest

* [cpuinfo] update baseline and port SHA

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/portfile.cmake

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* Update ports/cpuinfo/fix-install.patch

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>

* [cpuinfo] update port SHA

* [cpuinfo] recover find_package

* fixup target path to `share/unofficial-cpuinfo`
* change IMPORTED target name to `unofficial::cpuinfo::cpuinfo`

* [fbgemm] resolve failure after cpuinfo rename

* change cpuinfo::cpuinfo to unofficial

* [fbgemm] update port version

* [nnpack] use changes target name

* [nnpack] update port-version

Co-authored-by: Jack·Boos·Yu <47264268+JackBoosY@users.noreply.github.com>
2021-05-05 13:37:53 -07:00

82 lines
3.2 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e2d7d53..6d380e9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,28 @@ OPTION(CPUINFO_BUILD_UNIT_TESTS "Build cpuinfo unit tests" ON)
OPTION(CPUINFO_BUILD_MOCK_TESTS "Build cpuinfo mock tests" ON)
OPTION(CPUINFO_BUILD_BENCHMARKS "Build cpuinfo micro-benchmarks" ON)
+# Configuration
+set(config_install_dir "lib/cmake/unofficial-${PROJECT_NAME}")
+set(generated_dir "${CMAKE_CURRENT_BINARY_DIR}/generated")
+set(project_config "${generated_dir}/unofficial-${PROJECT_NAME}Config.cmake")
+set(targets_export_name "unofficial-${PROJECT_NAME}Targets")
+set(namespace "unofficial::${PROJECT_NAME}::")
+
+# Include module with fuction 'write_basic_package_version_file'
+include(CMakePackageConfigHelpers)
+configure_package_config_file(
+ "cmake/Config.cmake.in"
+ "${project_config}"
+ INSTALL_DESTINATION "${config_install_dir}"
+)
+install(FILES "${project_config}"
+ DESTINATION "${config_install_dir}"
+)
+install(EXPORT "${targets_export_name}"
+ NAMESPACE "${namespace}"
+ DESTINATION "${config_install_dir}"
+)
+
# ---[ CMake options
INCLUDE(GNUInstallDirs)
@@ -210,7 +232,7 @@ IF(CMAKE_SYSTEM_NAME MATCHES "^(Windows|CYGWIN|MSYS)$")
TARGET_COMPILE_DEFINITIONS(cpuinfo_internals PRIVATE _WIN32_WINNT=0x0601)
ENDIF()
SET_TARGET_PROPERTIES(cpuinfo PROPERTIES PUBLIC_HEADER include/cpuinfo.h)
-TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PUBLIC include)
+TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
TARGET_INCLUDE_DIRECTORIES(cpuinfo BEFORE PRIVATE src)
TARGET_INCLUDE_DIRECTORIES(cpuinfo_internals BEFORE PUBLIC include src)
IF(CPUINFO_LOG_LEVEL STREQUAL "default")
@@ -261,6 +283,7 @@ TARGET_LINK_LIBRARIES(cpuinfo PRIVATE clog)
TARGET_LINK_LIBRARIES(cpuinfo_internals PRIVATE clog)
INSTALL(TARGETS cpuinfo
+ EXPORT "${targets_export_name}"
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
diff --git a/cmake/Config.cmake.in b/cmake/Config.cmake.in
new file mode 100644
index 0000000..9b4c9ee
--- /dev/null
+++ b/cmake/Config.cmake.in
@@ -0,0 +1,4 @@
+@PACKAGE_INIT@
+
+include("${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake")
+check_required_components("@PROJECT_NAME@")
diff --git a/deps/clog/CMakeLists.txt b/deps/clog/CMakeLists.txt
index 083f519..43b5c78 100644
--- a/deps/clog/CMakeLists.txt
+++ b/deps/clog/CMakeLists.txt
@@ -57,7 +57,7 @@ SET_TARGET_PROPERTIES(clog PROPERTIES
C_EXTENSIONS NO)
CLOG_TARGET_RUNTIME_LIBRARY(clog)
SET_TARGET_PROPERTIES(clog PROPERTIES PUBLIC_HEADER include/clog.h)
-TARGET_INCLUDE_DIRECTORIES(clog BEFORE PUBLIC include)
+TARGET_INCLUDE_DIRECTORIES(clog PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
IF(CLOG_LOG_TO_STDIO)
TARGET_COMPILE_DEFINITIONS(clog PRIVATE CLOG_LOG_TO_STDIO=1)
ELSE()
@@ -68,6 +68,7 @@ IF(ANDROID AND NOT CLOG_LOG_TO_STDIO)
ENDIF()
INSTALL(TARGETS clog
+ EXPORT ${targets_export_name}
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")