[CMake] Fwd: Visual Studio command line from CMake

Rob McDonald rob.a.mcdonald at gmail.com
Thu Jan 9 00:46:16 EST 2014


Thanks for the tip, but that hasn't been very helpful to me.  Perhaps I'm
not doing it right.  Here is a bit of CMake code so the conversation can be
more concrete.  Perhaps someone on list can try it out...

You'll need these two files...

http://www.fltk.org/software.php?VERSION=1.3.2&FILE=fltk/1.3.2/fltk-1.3.2-source.tar.gz
http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip

Place them in the same directory with the following in the CMakeLists.txt

CMAKE_MINIMUM_REQUIRED( VERSION 2.8 )

INCLUDE( ExternalProject )

SET( VS_MAKEFILE_ZIP vsnet-makefiles.0.85.zip )

ExternalProject_Add( FLTK
URL ${CMAKE_SOURCE_DIR}/fltk-1.3.2-source.tar
UPDATE_COMMAND
 ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/${VS_MAKEFILE_ZIP}
<SOURCE_DIR>/${VS_MAKEFILE_ZIP}
 COMMAND
${CMAKE_COMMAND} -E tar -xzf <SOURCE_DIR>/${VS_MAKEFILE_ZIP}

 PATCH_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
 INSTALL_COMMAND ""
)


To build this manually, first, unzip both files into the same directory.
 Then, launch the Visual Studio Command Prompt, usually accessed via
the VS/vcvarsall.bat
program included with Visual Studio.

Once both files are unzipped into the same directory, and you are in the VS
prompt environment, you can build FLTK using the batch program 'gmake.bat'.

For better or worse, it prompts the user to input for Debug or Release, and
then for Verbose or Quiet.  If you make a simple text file with the entries
one per line...

******* input.txt
R
Q
*******

You can feed that to the batch program thusly....

gmake < input.txt

Alternately, if you can set DEBUG=R and VERBOSE=Q environment variables to
the shell used to run 'gmake.bat', then you don't have to feed the text
file for the user-input prompts.

I tried something like the following....

BUILD_COMMAND
   ${CMAKE_COMMAND} --build <SOURCE_DIR> -- gmake

But, it didn't seem to do anything useful....

Rob


On Wed, Jan 8, 2014 at 5:31 PM, J Decker <d3ck0r at gmail.com> wrote:

> cmake --build
>
> On Wed, Jan 8, 2014 at 3:53 PM, Rob McDonald <rob.a.mcdonald at gmail.com>
> wrote:
> > Short version:
> >
> > Does anyone have an elegant way to launch the visual studio command line
> > from within CMake?
> >
> > James Bigler asked essentially this question back in March of 2011.
>  David
> > responded with a link to a Blog entry, but I haven't figured out how to
> > translate that into something that works.
> >
> > The 'vcvarsall.bat' program that comes with Visual Studio will launch the
> > command line with the full environment set.
> >
> > Once I find vcvarsall, I then need to launch something in it -- and pass
> > parameters to that thing.  All from within ExternalProject_Add.  For now,
> > one step at a time...
> >
> > Long version:
> >
> > I'm trying to encapsulate the build of FLTK as an ExternalProject in
> CMake.
> > One way or the other, it needs to work for Visual Studio on Windows, and
> gcc
> > and llvm on Linux/MacOS.
> >
> > Although FLTK has a CMake build system, it is currently unmaintained
> (broken
> > on at least some platforms), and none of the core FLTK developers use
> it, so
> > I don't see this situation improving.
> >
> > I've got a ./configure based system working for Linux/MacOS.
> >
> > One of the FLTK developers maintains an unofficial Makefile setup for
> > FLKT/Visual Studio that must be run from the Visual Studio command
> prompt.
> > Hence my question...
> >
> > http://seriss.com/people/erco/fltk/tmp/vsnet-makefiles.0.85.zip
> >
> > Thanks for any help,
> >
> > Rob
> >
> >
> >
> >
> > --
> >
> > Powered by www.kitware.com
> >
> > Please keep messages on-topic and check the CMake FAQ at:
> > http://www.cmake.org/Wiki/CMake_FAQ
> >
> > Kitware offers various services to support the CMake community. For more
> > information on each offering, please visit:
> >
> > CMake Support: http://cmake.org/cmake/help/support.html
> > CMake Consulting: http://cmake.org/cmake/help/consulting.html
> > CMake Training Courses: http://cmake.org/cmake/help/training.html
> >
> > Visit other Kitware open-source projects at
> > http://www.kitware.com/opensource/opensource.html
> >
> > Follow this link to subscribe/unsubscribe:
> > http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140108/151436c1/attachment.htm>


More information about the CMake mailing list