build BUGFIX vdprintf() detection
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21d9aec..c09919b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -209,10 +209,8 @@
     src/log.h
     src/set.h)
 
+list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
 check_symbol_exists(vdprintf stdio.h HAVE_VDPRINTF)
-if(HAVE_VDPRINTF)
-    add_definitions(-DHAVE_VDPRINTF)
-endif(HAVE_VDPRINTF)
 
 # create static libyang library
 if(ENABLE_STATIC)