diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-06 16:14:47 -0400 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2021-11-09 15:17:19 +0000 |
commit | c033dd8a3e8f58f307d3e248a68b62252d3fc2c6 (patch) | |
tree | c2c543f3b8b659c05d09fb811ea86e5c2a9da8bc /src | |
parent | 1a8b2922d953e78bd51fc6d5ef290e1f7e00af3a (diff) | |
download | libgit2-ethomson/cmake2.tar.gz |
cmake: standardize USE_THREADS and USE_NSECethomson/cmake2
Threading can now be disabled with `USE_THREADS=OFF` instead of
`THREADSAFE=OFF` to better support the other cmake semantics.
Nanosecond support is the default _if_ we can detect it. This should be
our default always - like threads - and people can opt out explicitly.
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 6 | ||||
-rw-r--r-- | src/thread.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9812fc0e4..de8beefd8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,11 +81,11 @@ if(NEED_LIBRT) list(APPEND LIBGIT2_PC_LIBS "-lrt") endif() -if(THREADSAFE) +if(USE_THREADS) list(APPEND LIBGIT2_LIBS ${CMAKE_THREAD_LIBS_INIT}) list(APPEND LIBGIT2_PC_LIBS ${CMAKE_THREAD_LIBS_INIT}) endif() -add_feature_info(threadsafe THREADSAFE "threadsafe support") +add_feature_info(threadsafe USE_THREADS "threadsafe support") if(WIN32 AND EMBED_SSH_PATH) @@ -277,7 +277,7 @@ endif() add_feature_info(iconv GIT_USE_ICONV "iconv encoding conversion support") -if(THREADSAFE) +if(USE_THREADS) if(NOT WIN32) find_package(Threads REQUIRED) endif() diff --git a/src/thread.h b/src/thread.h index 4b091c0a2..82eb7fcab 100644 --- a/src/thread.h +++ b/src/thread.h @@ -12,7 +12,7 @@ #if defined(__clang__) # if (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 1)) -# error Atomic primitives do not exist on this version of clang; configure libgit2 with -DTHREADSAFE=OFF +# error Atomic primitives do not exist on this version of clang; configure libgit2 with -DUSE_THREADS=OFF # else # define GIT_BUILTIN_ATOMIC # endif @@ -20,7 +20,7 @@ #elif defined(__GNUC__) # if (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 1)) -# error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DTHREADSAFE=OFF +# error Atomic primitives do not exist on this version of gcc; configure libgit2 with -DUSE_THREADS=OFF # elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) # define GIT_BUILTIN_ATOMIC # else |