I use the environment variable:

VS110COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\Tools\

to locate Visual Studio 2012 (vs11) on my machine.

So, in CMake code, you could use $ENV{VS110COMNTOOLS} to specify the path to the batch file if you need it.

The easiest thing to do is probably a find_program(nmake).... and if it's not found put up a warning message, saying "you need to run this build from a Visual Studio command prompt".


HTH,
David



-----Original Message-----
From: Magnus Therning <[email protected]>
To: cmake <[email protected]>
Sent: Sat, Nov 23, 2013 4:41 pm
Subject: Re: [CMake] ExternalProject BUILD_COMMAND and Visual Studio Express 2010


On Sat, Nov 23, 2013 at 08:54:24AM -0700, Macumber, Daniel wrote:
Thanks Magnus, is there a reliable way to get the path to
vcvarsall.bat that will work for various versions of Visual Studio
(express or not)?

I don't know of any sure way of doing that, but if vcvarsall.bat is
located in the same relative place across all versions of VS then it
might be possible to sort of misuse some variable that CMake sets.

I had a quick look in one project I build with VS2010 and found one
candidate variable: CMAKE_LINKER.

CMAKE_LINKER = C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/link.exe
vcvarsall.bat location = C:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/vcvarsall.bat

I'd consider that a terrible hack though, so hopefully there's someone
else with a better idea.

/M

--
Magnus Therning                      OpenPGP: 0xAB4DFBA4
email: [email protected]   jabber: [email protected]
twitter: magthe               http://therning.org/magnus

Beauty is more important in computing than anywhere else in technology
because software is so complicated. Beauty is the ultimate defence
against complexity.
    -- David Gelernter


--

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

--

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

Reply via email to