]> granicus.if.org Git - check/commitdiff
In cmake build, use mkstemp when present
authorJoshua D. Boyd <jdboyd@jdboyd.net>
Tue, 22 Mar 2016 04:50:34 +0000 (00:50 -0400)
committerJoshua D. Boyd <jdboyd@jdboyd.net>
Wed, 23 Mar 2016 02:58:16 +0000 (22:58 -0400)
This fixes this error, seen when building with cmake:

    check/src/check_msg.c:247: warning: the use of 'tempnam' is dangerous, better use `mkstemp'

CMakeLists.txt checks for mkstemp being present and sents a cmake
variable HAVE_MKSTEMP.  The check_msg.c file will use mkstemp if
HAVE_MKSTEMP is true, but the cmake variable wasn't causing HAVE_MKSTEMP
to be defined for the C compiler.

CMakeLists.txt

index a02ea5454d48fbbd59d569862305557a541e5968..59c71281a6447bad37ab0ff4bf994fe15f4205fe 100644 (file)
@@ -141,6 +141,15 @@ else(HAVE_FORK)
     set(HAVE_FORK 0)
 endif(HAVE_FORK)
 
+if(HAVE_MKSTEMP)
+    add_definitions(-DHAVE_MKSTEMP=1)
+    set(HAVE_MKSTEMP 1)
+else(HAVE_MKSTEMP)
+    add_definitions(-DHAVE_MKSTEMP=0)
+    set(HAVE_MKSTEMP 0)
+endif(HAVE_MKSTEMP)
+
+
 ###############################################################################
 # Check defines
 set(headers "limits.h")