diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2017-07-23 19:58:08 +0300 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2017-08-01 19:09:07 -0400 |
commit | 0ab9f2306185a6e534674167a4d40f32ea6ff670 (patch) | |
tree | 98baf7a14564292f875ebdb68213913283ec96e0 | |
parent | 0ed0bcce4902db366d74a52794f7e71e73a47d41 (diff) | |
download | meson-0ab9f2306185a6e534674167a4d40f32ea6ff670.zip meson-0ab9f2306185a6e534674167a4d40f32ea6ff670.tar.gz meson-0ab9f2306185a6e534674167a4d40f32ea6ff670.tar.bz2 |
Add thread flags to checks if needed. Closes #2106.
-rw-r--r-- | mesonbuild/compilers/c.py | 4 | ||||
-rw-r--r-- | test cases/linuxlike/9 compiler checks with dependencies/meson.build | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 5de39d4..018c353 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -273,9 +273,13 @@ class CCompiler(Compiler): for d in dependencies: # Add compile flags needed by dependencies args += d.get_compile_args() + if d.need_threads(): + args += self.thread_flags() if mode == 'link': # Add link flags needed to find dependencies args += d.get_link_args() + if d.need_threads(): + args += self.thread_link_flags() # Select a CRT if needed since we're linking if mode == 'link': args += self.get_linker_debug_crt_args() diff --git a/test cases/linuxlike/9 compiler checks with dependencies/meson.build b/test cases/linuxlike/9 compiler checks with dependencies/meson.build index 2aa9015..bebfb84 100644 --- a/test cases/linuxlike/9 compiler checks with dependencies/meson.build +++ b/test cases/linuxlike/9 compiler checks with dependencies/meson.build @@ -29,3 +29,10 @@ int main(int argc, char *argv[]) { assert (cc.has_function('deflate', prefix : '#include<zlib.h>', dependencies : zlib, name : 'Test for function in zlib'), 'has_function test failed.') assert (cc.links(linkcode, dependencies : zlib, name : 'Test link against zlib'), 'Linking test failed against zlib.') endif + +assert(cc.has_function('pthread_create', + dependencies : dependency('threads'), + prefix : '#include <pthread.h>'), + 'Could not detect pthread_create with a thread dependency.') + + |