Skip to content

Commit 3418797

Browse files
silvanshadealyssais
authored andcommitted
tbb_2021_11_0: fix static builds
Fixes: NixOS/nix#13160 This is a backport of uxlfoundation/oneTBB#1248
1 parent 778e991 commit 3418797

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

pkgs/development/libraries/tbb/default.nix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ stdenv.mkDerivation rec {
5050
url = "https://patch-diff.githubusercontent.com/raw/uxlfoundation/oneTBB/pull/1696.patch";
5151
hash = "sha256-yjX2FkOK8bz29a/XSA7qXgQw9lxzx8VIgEBREW32NN4=";
5252
})
53+
# Fix Threads::Threads target for static from https://github.com/oneapi-src/oneTBB/pull/1248
54+
# This is a conflict-resolved cherry-pick of the above PR to due to formatting differences.
55+
./patches/fix-cmake-threads-threads-target-for-static.patch
5356
];
5457

5558
# Fix build with modern gcc
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From b42f074a724a41d2369a94283a2e94190d0cbb44 Mon Sep 17 00:00:00 2001
2+
From: Liam Keegan <[email protected]>
3+
Date: Fri, 10 Nov 2023 09:08:42 +0100
4+
Subject: [PATCH] Fix CMake "Threads::Threads target not found" issue for
5+
static builds (#1248)
6+
7+
- add `Threads` dependency to installed CMake config for static builds only
8+
- based on #912 by @p12tic including reviewer comments from @ilya-lavrenov and @isaevil
9+
- resolves #1145
10+
11+
Signed-off-by: Liam Keegan <[email protected]>
12+
(cherry picked from commit 12ceae12138af08845b3e8c369b24527346fe99e)
13+
---
14+
CMakeLists.txt | 4 ++++
15+
1 file changed, 4 insertions(+)
16+
17+
diff --git a/CMakeLists.txt b/CMakeLists.txt
18+
index 16ee29ed..0bc39a52 100644
19+
--- a/CMakeLists.txt
20+
+++ b/CMakeLists.txt
21+
@@ -265,6 +265,10 @@ else()
22+
COMPONENT devel)
23+
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
24+
"include(\${CMAKE_CURRENT_LIST_DIR}/${PROJECT_NAME}Targets.cmake)\n")
25+
+ if (NOT BUILD_SHARED_LIBS)
26+
+ file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
27+
+ "include(CMakeFindDependencyMacro)\nfind_dependency(Threads)\n")
28+
+ endif()
29+
30+
write_basic_package_version_file("${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
31+
COMPATIBILITY AnyNewerVersion)
32+
--
33+
2.49.0
34+

0 commit comments

Comments
 (0)