mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-12 21:29:00 +08:00
102 lines
4.2 KiB
Diff
102 lines
4.2 KiB
Diff
From 16095678843dadf13b0f786ddf53c726e837bc74 Mon Sep 17 00:00:00 2001
|
|
From: Wei Dai <wei.dai@microsoft.com>
|
|
Date: Tue, 8 Jun 2021 15:55:18 -0700
|
|
Subject: [PATCH] Disabled downloading cpu-features.
|
|
|
|
---
|
|
CMakeLists.txt | 9 ++++++++-
|
|
hexl/CMakeLists.txt | 15 ++++++---------
|
|
2 files changed, 14 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
index 05e42f9..a7ad993 100644
|
|
--- a/CMakeLists.txt
|
|
+++ b/CMakeLists.txt
|
|
@@ -183,7 +183,14 @@ message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
|
#------------------------------------------------------------------------------
|
|
# Third-party code...
|
|
#------------------------------------------------------------------------------
|
|
-add_subdirectory(cmake/cpu-features)
|
|
+find_package(CpuFeatures CONFIG REQUIRED)
|
|
+if(CpuFeatures_FOUND)
|
|
+ add_library(cpu_features ALIAS CpuFeatures::cpu_features)
|
|
+ get_target_property(
|
|
+ CpuFeatures_INCLUDE_DIR
|
|
+ CpuFeatures::cpu_features
|
|
+ INTERFACE_INCLUDE_DIRECTORIES)
|
|
+endif()
|
|
|
|
if (HEXL_TESTING OR HEXL_BENCHMARK OR HEXL_DEBUG)
|
|
if(NOT TARGET Threads::Threads)
|
|
diff --git a/hexl/CMakeLists.txt b/hexl/CMakeLists.txt
|
|
index 7e603e3..b83a94e 100644
|
|
--- a/hexl/CMakeLists.txt
|
|
+++ b/hexl/CMakeLists.txt
|
|
@@ -44,6 +44,7 @@ target_include_directories(hexl
|
|
PUBLIC $<BUILD_INTERFACE:${HEXL_INC_ROOT_DIR}> # Public headers
|
|
PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> # Public headers
|
|
)
|
|
+target_include_directories(hexl PUBLIC ${CpuFeatures_INCLUDE_DIR}) # Public headers
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
target_compile_options(hexl PRIVATE -Wall -Wconversion -Wshadow -pedantic -Wextra
|
|
@@ -74,7 +75,7 @@ else ()
|
|
# For proper export of IntelHEXLConfig.cmake / IntelHEXLTargts.cmake,
|
|
# we avoid explicitly linking dependencies via target_link_libraries, since
|
|
# this would add dependencies to the exported hexl target.
|
|
- add_dependencies(hexl cpu_features)
|
|
+ target_link_libraries(hexl PRIVATE cpu_features)
|
|
if (HEXL_DEBUG)
|
|
add_dependencies(hexl gflags)
|
|
# Manually add logging include directory
|
|
@@ -95,42 +96,38 @@ else ()
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
add_custom_command(TARGET hexl POST_BUILD
|
|
COMMAND ar -x $<TARGET_FILE:hexl>
|
|
- COMMAND ar -x $<TARGET_FILE:cpu_features>
|
|
COMMAND ar -x $<TARGET_FILE:gflags>
|
|
COMMAND ar -x $<TARGET_FILE:easyloggingpp>
|
|
COMMAND ar -qcs $<TARGET_FILE:hexl> *.o
|
|
COMMAND rm -f *.o
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
- DEPENDS hexl cpu_features gflags easyloggingpp
|
|
+ DEPENDS hexl gflags easyloggingpp
|
|
)
|
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
add_custom_command(TARGET hexl POST_BUILD
|
|
COMMAND lib.exe /OUT:$<TARGET_FILE:hexl>
|
|
$<TARGET_FILE:hexl>
|
|
- $<TARGET_FILE:cpu_features>
|
|
$<TARGET_FILE:gflags>
|
|
$<TARGET_FILE:easyloggingpp>
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
- DEPENDS hexl cpu_features gflags easyloggingpp
|
|
+ DEPENDS hexl gflags easyloggingpp
|
|
)
|
|
endif()
|
|
else()
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
|
add_custom_command(TARGET hexl POST_BUILD
|
|
COMMAND ar -x $<TARGET_FILE:hexl>
|
|
- COMMAND ar -x $<TARGET_FILE:cpu_features>
|
|
COMMAND ar -qcs $<TARGET_FILE:hexl> *.o
|
|
COMMAND rm -f *.o
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
- DEPENDS hexl cpu_features
|
|
+ DEPENDS hexl
|
|
)
|
|
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
add_custom_command(TARGET hexl POST_BUILD
|
|
COMMAND lib.exe /OUT:$<TARGET_FILE:hexl>
|
|
$<TARGET_FILE:hexl>
|
|
- $<TARGET_FILE:cpu_features>
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
|
- DEPENDS hexl cpu_features
|
|
+ DEPENDS hexl
|
|
)
|
|
endif()
|
|
endif()
|
|
--
|
|
2.25.1
|
|
|