-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a cmake utilities library for functions or macros that will be shared across CMake files. For now, just add a function to check the availability of pthread_setname_np(3). This is in preparation of adding support for thread names where we'll also check this from the top level CMake file. Signed-off-by: Nuno Sá <nuno.sa@analog.com>
- Loading branch information
Showing
2 changed files
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
function(check_pthread_set_name HAS_PTHREAD) | ||
include(CheckSymbolExists) | ||
set(CMAKE_REQUIRED_LIBRARIES ${PTHREAD_LIBRARIES}) | ||
set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) | ||
set(TMP_FLAGS "${CMAKE_C_FLAGS}") | ||
set(CMAKE_C_FLAGS "") | ||
check_symbol_exists(pthread_setname_np "pthread.h" ${HAS_PTHREAD}) | ||
set(CMAKE_C_FLAGS "${TMP_FLAGS}") | ||
set(CMAKE_REQUIRED_LIBRARIES) | ||
set(CMAKE_REQUIRED_DEFINITIONS) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters