From 3bbd45e73f8991ede52887e72044204463b8ffe4 Mon Sep 17 00:00:00 2001 From: "Joshua D. Boyd" Date: Tue, 22 Mar 2016 00:50:34 -0400 Subject: [PATCH] In cmake build, use mkstemp when present 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 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index a02ea54..59c7128 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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") -- 2.40.0