To Phil, Jim, and Greg:

Do any of you have access to VC14 (a.k.a Visual Studio 2015)?  If so
I need your Windows expertise for dealing with the bug report below
which is likely the tip of the iceberg for a whole bunch of
troubles with Windows linking for that platform.  For example,
I looked up Universal CRT, and found
<http://blogs.msdn.com/b/vcblog/archive/2015/03/03/introducing-the-universal-crt.aspx>
which appears to say that linking should be different for VC14 and
beyond.  But if that is the case, the proper cure for this issue
is to set one or more of

CMAKE_REQUIRED_FLAGS = string of compile command line flags
CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
CMAKE_REQUIRED_INCLUDES = list of include directories
CMAKE_REQUIRED_LIBRARIES = list of libraries to link

appropriately before _all_ calls to check_* CMake functions such as
the particular use of check_function_exists below.  But I need your
advice on what the values of the above variables should be for VC14
and beyond.

To explore what is possible I recommend using some variant (with
some of the above variables set) of the following test cmake
mini-project.

cmake_minimum_required(VERSION 2.8.9)
project(test_check C)
include(CheckFunctionExists)
check_function_exists(snprintf PL_HAVE_SNPRINTF)
message(STATUS "PL_HAVE_SNPRINTF = ${PL_HAVE_SNPRINTF}")

This project gives good results, i.e.,

-- The C compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for snprintf
-- Looking for snprintf - found
-- PL_HAVE_SNPRINTF = 1
-- Configuring done
-- Generating done
-- Build files have been written to: /home/irwin/test_cmake2/build_dir

for me on Linux, and my question for you boils down to what values
need to be assigned to the above variables so this mini-project also
works (i.e., yields PL_HAVE_SNPRINTF = 1) on VC14 for the latest CMake
version you have access to?

By the way, our handling of the CMAKE_REQUIRED_* variables for the
check_* CMake functions that we use is currently a mess, and I am in
the process of fixing that.  If your run of the above test for VC14
shows no CMAKE_DEFINED_* variables have to be set, then my fix will be
the only required change.  However, if CMAKE_DEFINED_* variables do
have to be set in order for the above test to work, my fix will put me
in a good position to use that information.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state
implementation for stellar interiors (freeeos.sf.net); the Time
Ephemerides project (timeephem.sf.net); PLplot scientific plotting
software package (plplot.sf.net); the libLASi project
(unifont.org/lasi); the Loads of Linux Links project (loll.sf.net);
and the Linux Brochure Project (lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

---------- Forwarded message ----------
Date: Thu, 03 Sep 2015 12:07:41 +0000
From: Torsten Martinsen <bullest...@users.sf.net>
Reply-To: Ticket 179 <1...@bugs.plplot.p.re.sf.net>
To: Ticket 179 <1...@bugs.plplot.p.re.sf.net>
Subject: [plplot:bugs] #179 Detection of snprintf fails with VC14




---

** [bugs:#179] Detection of snprintf fails with VC14**

**Status:** open
**Group:**
**Labels:** vc14
**Created:** Thu Sep 03, 2015 12:07 PM UTC by Torsten Martinsen
**Last Updated:** Thu Sep 03, 2015 12:07 PM UTC
**Owner:** nobody


Due to the Universal CRT introduced in VC14 (aka Visual Studio 2015), 
check_function_exists() no longer works for detecting the presence of 
snprintf(). This leads to a linker error when using the library.

This patch fixed it for me:
~~~~
diff --git a/cmake/modules/plplot.cmake b/cmake/modules/plplot.cmake
index 90aac62..7fea410 100644
--- a/cmake/modules/plplot.cmake
+++ b/cmake/modules/plplot.cmake
@@ -347,7 +347,11 @@ if(PL__HAVE_ISINF)
  endif(PL__HAVE_ISINF)


-check_function_exists(snprintf PL_HAVE_SNPRINTF)
+if(MSVC_VERSION EQUAL 1900)
+  set(PL_HAVE_SNPRINTF 1)
+else(MSVC_VERSION EQUAL 1900)
+  check_function_exists(snprintf PL_HAVE_SNPRINTF)
+endif(MSVC_VERSION EQUAL 1900)
  if(NOT PL_HAVE_SNPRINTF)
    check_function_exists(_snprintf _PL_HAVE_SNPRINTF)
    set(PL_HAVE_SNPRINTF ${_PL_HAVE_SNPRINTF} CACHE INTERNAL "Have function 
_sprintf")
~~~~


---

Sent from sourceforge.net because you indicated interest in 
<https://sourceforge.net/p/plplot/bugs/179/>



To unsubscribe from further messages, please visit 
<https://sourceforge.net/auth/subscriptions/>

------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to