2 # tuklib_common.cmake - common functions and macros for tuklib_*.cmake files
6 # This file has been put into the public domain.
7 # You can do whatever you want with this file.
10 function(tuklib_add_definitions TARGET_OR_ALL DEFINITIONS)
11 # DEFINITIONS may be an empty string/list but it's fine here. There is
12 # no need to quote ${DEFINITIONS} as empty arguments are fine here.
13 if(TARGET_OR_ALL STREQUAL "ALL")
14 add_compile_definitions(${DEFINITIONS})
16 target_compile_definitions("${TARGET_OR_ALL}" PRIVATE ${DEFINITIONS})
20 function(tuklib_add_definition_if TARGET_OR_ALL VAR)
22 tuklib_add_definitions("${TARGET_OR_ALL}" "${VAR}")
26 # This is an over-simplified version of AC_USE_SYSTEM_EXTENSIONS in Autoconf
27 # or gl_USE_SYSTEM_EXTENSIONS in gnulib.
28 macro(tuklib_use_system_extensions TARGET_OR_ALL)
30 # FIXME? The Solaris-specific __EXTENSIONS__ should be conditional
31 # even on Solaris. See gnulib: git log m4/extensions.m4.
32 # FIXME? gnulib and autoconf.git has lots of new stuff.
33 tuklib_add_definitions("${TARGET_OR_ALL}"
36 _POSIX_PTHREAD_SEMANTICS
41 list(APPEND CMAKE_REQUIRED_DEFINITIONS
44 -D_POSIX_PTHREAD_SEMANTICS