Hi Alan
I found the same location in the file you specified between checking emails. I have been through and added the \" where appropriate to the various (rpath, compile, linker) flags. This allows me to compile, but I am getting linker errors in the examples, because the linker flags are ending up as
"C:/Program Files/Tcl/lib/tcl86.lib".lib
I'm not sure where the extra .lib is appearing from. If I fix this manually I then get further linker errors which seem to be name decoration static vs dynamic library issues. I will have to figure those out on my system. 

From: Alan W. Irwin <irwin@beluga.phys.uvic.ca>
To: Phil Rosenberg <philip_rosenberg@yahoo.com>
Cc: PLplot development list <plplot-devel@lists.sourceforge.net>
Sent: Thursday, 28 August 2014, 21:29
Subject: RE: [Plplot-devel] tcl build problem

On 2014-08-28 20:33+0100 Phil Rosenberg wrote:

> Hi Alan

> Given what you said I did a quick google for cmake paths spaces and
immediately found this post
Seems the issue is the same there and is a result of the find modules
assuming no whitespace. I'll see if I can work out where the quotes
should go and if not then I'll uninstall and reinstall tcl I guess.

Hi Phil:

I mostly agree with everything I read at that stackoverflow site but
compile flags are a special case where the result must be a blank
delimited string (as opposed to a CMake list).

Looking further (in cmake/modules/tk.cmake) the culprit appears to be
the command


(where it just happens -I${TCL_INCLUDE_PATH} and
${TKLIB_COMPILE_FLAGS} refer to the same thing on your system, but on
other systems they can be different and the repeat duplicate -I
options should not be an issue on your system.

When faced with CMake logic issues, it is always a good
idea to make a few-line file to test out possibilities.

In this case my test file (test.cmake) reads

# Note the quotes which keep TCL_INCLUDE_PATH and TKLIB_COMPILE_FLAGS
# from being lists.  I think these represent the CMake variables
# exactly on your system.
set(TCL_INCLUDE_PATH "C:/Program Files/Tcl/include")
set(TKLIB_COMPILE_FLAGS "-IC:/Program Files/Tcl/include")

#Wrong (as currently the case in cmake/modules/tk.cmake)
message(STATUS "wrong ntk_COMPILE_FLAGS = ${ntk_COMPILE_FLAGS}")
#Right (I hope)
message(STATUS "right ntk_COMPILE_FLAGS = ${ntk_COMPILE_FLAGS}")

and you run it like this:

irwin@raven> cmake -P test.cmake
-- wrong ntk_COMPILE_FLAGS = -IC:/Program Files/Tcl/include -IC:/Program Files/Tcl/include
-- right ntk_COMPILE_FLAGS = "-IC:/Program Files/Tcl/include" "-IC:/Program Files/Tcl/include"

I suggest you change cmake/modules/tk.cmake to conform to the second
form, and then observe (via the VERBOSE=1 option on nmake) the
resulting build command.  My hope is that one string with
blank-separated entities that are themselves quoted using escaped
quotes (the "right" version above) will force CMake to generate
compile options of either

"-IC:/Program Files/Tcl/include" "-IC:/Program Files/Tcl/include"


-IC:/Program Files/Tcl/include -IC:/Program Files/Tcl/include

But let me know what the VERBOSE=1 nmake option tells you
about the actual build command that results from the above

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