1 # SPDX-License-Identifier: 0BSD
3 #############################################################################
5 # tuklib_common.cmake - common functions and macros for tuklib_*.cmake files
9 #############################################################################
11 function(tuklib_add_definitions TARGET_OR_ALL DEFINITIONS)
12 # DEFINITIONS may be an empty string/list but it's fine here. There is
13 # no need to quote ${DEFINITIONS} as empty arguments are fine here.
14 if(TARGET_OR_ALL STREQUAL "ALL")
15 add_compile_definitions(${DEFINITIONS})
17 target_compile_definitions("${TARGET_OR_ALL}" PRIVATE ${DEFINITIONS})
21 function(tuklib_add_definition_if TARGET_OR_ALL VAR)
23 tuklib_add_definitions("${TARGET_OR_ALL}" "${VAR}")
27 # This is an over-simplified version of AC_USE_SYSTEM_EXTENSIONS in Autoconf
28 # or gl_USE_SYSTEM_EXTENSIONS in gnulib.
29 macro(tuklib_use_system_extensions TARGET_OR_ALL)
31 # FIXME? The Solaris-specific __EXTENSIONS__ should be conditional
32 # even on Solaris. See gnulib: git log m4/extensions.m4.
33 # FIXME? gnulib and autoconf.git has lots of new stuff.
34 tuklib_add_definitions("${TARGET_OR_ALL}"
37 _POSIX_PTHREAD_SEMANTICS
42 list(APPEND CMAKE_REQUIRED_DEFINITIONS
45 -D_POSIX_PTHREAD_SEMANTICS