[CMake] FW: Visual Studio 2017

Robert Maynard robert.maynard at kitware.com
Tue Sep 19 16:57:54 EDT 2017


While the preshing article on CMake is really good, it didn't clearly
cover the fact that Visual Studio projects generated by CMake can be
built from the command line using cmake --build <build_dir> --config <
Release/Debug/... >

On Tue, Sep 19, 2017 at 4:44 PM, Randy Heiland <randy.heiland at gmail.com> wrote:
> What I'm finding online so far seems to indicate that one would need to open
> the Visual Studio app in order to do something with the .sln. Is that true?
> If so, it's not really desirable... well, maybe it is for some users, but,
> in general, I'd like to provide a command line solution. Is that possible?
>
> related links:
> http://preshing.com/20170511/how-to-build-a-cmake-based-project/#building-with-visual-studio
> https://docs.microsoft.com/en-us/visualstudio/extensibility/internals/solution-dot-sln-file
>
>
>
> On Tue, Sep 19, 2017 at 4:26 PM, Hendrik Sattler <post at hendrik-sattler.de>
> wrote:
>>
>>
>>
>> Am 19. September 2017 22:05:36 MESZ schrieb Randy Heiland
>> <randy.heiland at gmail.com>:
>> >I'd love to learn more about this option, assuming it's a simple
>> >workflow
>> >via the command line. If there's a writeup related to cmake, would
>> >welcome
>> >a pointer. If you can't tell, I'm not really a Windows guy; I'm just
>> >trying
>> >to support that community. Hopefully what you're describing would not
>> >require a user having to fiddle with their PATH env var.
>>
>> Just type "cmake --build" to see all options.
>>
>> "cmake --build . --config release" will build the release configuration of
>> a generated .sln file.
>>
>> >On Tue, Sep 19, 2017 at 2:47 PM, Hendrik Sattler
>> ><post at hendrik-sattler.de>
>> >wrote:
>> >
>> >>
>> >>
>> >> Am 19. September 2017 17:51:31 MESZ schrieb Randy Heiland <
>> >> randy.heiland at gmail.com>:
>> >> >I failed to send my previous reply to the list - see below for that.
>> >> >This
>> >> >is a follow-on, using the repo mentioned previously.
>> >> >
>> >> >--- Attempt #1
>> >> >
>> >> >#   Pointing out that my Command Prompt shell doesn't need to know
>> >> >about
>> >> >the 'cl' compiler, in order to run cmake:
>> >> >C:\Users\Owner\dev\cmake_learn\cmake_learn-master\build>cl
>> >> >'cl' is not recognized as an internal or external command,
>> >> >operable program or batch file.
>> >> >
>> >> >
>> >> >C:\Users\Owner\dev\cmake_learn\cmake_learn-master\build>cmake ..
>> >> >-- Building for: Visual Studio 15 2017
>> >> >-- The C compiler identification is MSVC 19.11.25508.2
>> >> >-- The CXX compiler identification is MSVC 19.11.25508.2
>> >> >-- Check for working C compiler: C:/Program Files (x86)/Microsoft
>> >> >Visual
>> >>
>> >>Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
>> >> >-- Check for working C compiler: C:/Program Files (x86)/Microsoft
>> >> >Visual
>> >>
>> >>Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
>> >> >--
>> >> >works
>> >> >-- Detecting C compiler ABI info
>> >> >-- Detecting C compiler ABI info - done
>> >> >-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft
>> >> >Visual
>> >>
>> >>Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
>> >> >-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft
>> >> >Visual
>> >>
>> >>Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x86/cl.exe
>> >> >--
>> >> >works
>> >> >-- Detecting CXX compiler ABI info
>> >> >-- Detecting CXX compiler ABI info - done
>> >> >-- Detecting CXX compile features
>> >> >-- Detecting CXX compile features - done
>> >> >-- Found OpenMP_C: -openmp (found version "2.0")
>> >> >-- Found OpenMP_CXX: -openmp (found version "2.0")
>> >> >-- Configuring done
>> >> >-- Generating done
>> >> >-- Build files have been written to: C:/Users/Owner/dev/cmake_learn
>> >> >/cmake_learn-master/build
>> >> >
>> >> >This successfully builds the following files, but no Makefile so
>> >that I
>> >> >can
>> >> >simply run 'nmake' from the command line:
>> >>
>> >> Maybe you should realize that any purposed use of nmake is outdated
>> >by
>> >> years. You can build .sln files from command line just fine. CMake
>> >even
>> >> wraps the command with --build option.
>> >>
>> >> Only use nmake when you have no other options.
>> >>
>> >> HS
>> >>
>> >> --
>> >> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>> >> gesendet.
>> >>
>>
>> --
>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>> gesendet.
>
>
>
> --
>
> 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://public.kitware.com/mailman/listinfo/cmake


More information about the CMake mailing list