Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/pytorch/cpuinfo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetr Hosek <petrhosek@users.noreply.github.com>2022-06-18 02:55:46 +0300
committerGitHub <noreply@github.com>2022-06-18 02:55:46 +0300
commit082deffc80ce517f81dc2f3aebe6ba671fcd09c9 (patch)
tree617a393e4a650cd77a8e70bf781e29302d6ac9e4
parent9fa621933fc6080b96fa0f037cdc7cd2c69ab272 (diff)
Define namespace prefixed alias for cpuinfo in the CMake build (#89)
This allows projects that depend on cpuinfo to use namespace qualified target name regardless of whether they consume cpuinfo through add_subdirectory or find_package.
-rw-r--r--CMakeLists.txt2
-rw-r--r--deps/clog/CMakeLists.txt2
2 files changed, 4 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74364e8..7c28761 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -264,6 +264,8 @@ ENDIF()
TARGET_LINK_LIBRARIES(cpuinfo PRIVATE clog)
TARGET_LINK_LIBRARIES(cpuinfo_internals PRIVATE clog)
+ADD_LIBRARY(${PROJECT_NAME}::cpuinfo ALIAS cpuinfo)
+
# support find_package(cpuinfo CONFIG)
INCLUDE(CMakePackageConfigHelpers)
GET_FILENAME_COMPONENT(CONFIG_FILE_PATH ${CMAKE_CURRENT_BINARY_DIR}/cpuinfo-config.cmake ABSOLUTE)
diff --git a/deps/clog/CMakeLists.txt b/deps/clog/CMakeLists.txt
index ab1840b..4f34d23 100644
--- a/deps/clog/CMakeLists.txt
+++ b/deps/clog/CMakeLists.txt
@@ -67,6 +67,8 @@ IF(ANDROID AND NOT CLOG_LOG_TO_STDIO)
TARGET_LINK_LIBRARIES(clog PRIVATE log)
ENDIF()
+ADD_LIBRARY(cpuinfo::clog ALIAS clog)
+
INSTALL(TARGETS clog
EXPORT cpuinfo-targets
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"