mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-26 08:57:50 +08:00
49 lines
1.6 KiB
Diff
49 lines
1.6 KiB
Diff
|
diff --git a/CMake/GenPkgConfig.cmake b/CMake/GenPkgConfig.cmake
|
||
|
index f8701b4..00a1e75 100644
|
||
|
--- a/CMake/GenPkgConfig.cmake
|
||
|
+++ b/CMake/GenPkgConfig.cmake
|
||
|
@@ -92,7 +92,19 @@ function(gen_pkgconfig_vars)
|
||
|
|
||
|
# Set the output variables
|
||
|
string(REPLACE ";" " " cflags "${cflags}")
|
||
|
- set("${var_prefix}_CFLAGS" "${cflags}" PARENT_SCOPE)
|
||
|
string(REPLACE ";" " " private_libs "${private_libs}")
|
||
|
+
|
||
|
+ # Since CMake 3.18 FindThreads may include a generator expression requiring
|
||
|
+ # a target, which gets propagated to us through INTERFACE_COMPILE_OPTIONS.
|
||
|
+ # Before CMake 3.19 there's no way to solve this in a general way, so we
|
||
|
+ # work around the specific case. See #1414 and CMake bug #21074.
|
||
|
+ if(CMAKE_VERSION VERSION_LESS 3.19)
|
||
|
+ string(REPLACE
|
||
|
+ "<COMPILE_LANG_AND_ID:CUDA,NVIDIA>" "<COMPILE_LANGUAGE:CUDA>"
|
||
|
+ cflags "${cflags}"
|
||
|
+ )
|
||
|
+ endif()
|
||
|
+
|
||
|
+ set("${var_prefix}_CFLAGS" "${cflags}" PARENT_SCOPE)
|
||
|
set("${var_prefix}_PRIVATE_LIBS" "${private_libs}" PARENT_SCOPE)
|
||
|
endfunction()
|
||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||
|
index 2de9298..950dd76 100644
|
||
|
--- a/CMakeLists.txt
|
||
|
+++ b/CMakeLists.txt
|
||
|
@@ -414,10 +414,18 @@ configure_file(
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/libfolly.pc.gen
|
||
|
@ONLY
|
||
|
)
|
||
|
+
|
||
|
+# Specify target to allow resolving generator expressions requiring
|
||
|
+# a target for CMake >=3.19. See #1414.
|
||
|
+if(NOT CMAKE_VERSION VERSION_LESS 3.19)
|
||
|
+ set(target_arg TARGET folly_deps)
|
||
|
+endif()
|
||
|
+
|
||
|
file(
|
||
|
GENERATE
|
||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/libfolly.pc
|
||
|
INPUT ${CMAKE_CURRENT_BINARY_DIR}/libfolly.pc.gen
|
||
|
+ ${target_arg}
|
||
|
)
|
||
|
install(
|
||
|
FILES ${CMAKE_CURRENT_BINARY_DIR}/libfolly.pc
|