Environment variable used by CMake to detect Visual C++ compiler tools for Ninja -
i have mingw64 gcc 6.3.0 (always in path
) , visual c++ compiler tools visual studio 2017 rtm (not in path
).
if run cmake . -g "mingw makefiles"
, gcc 6.3.0 selected.
if run cmake . -g "ninja"
, gcc 6.3.0 selected.
my visual c++ compiler tools none standard, keep parts need , delete rest (like msbuild, ide etc.). use own batch script set path
, include
, lib
(works fine).
if run batch script , run cmake .
, msvc selected , build nmake.
with same environment, cmake . -g "ninja"
, gcc 6.3.0 selected instead of msvc.
so question is, how tell cmake want use msvc + ninja rather gcc + ninja when both in path
? environment variable should set?
you can use inverted approach , exclude compilers don't want cmake_ignore_path
. takes list of paths ignore, aware needs exact string match. advantage can declare directly command line.
so did take path compiler found "not taken" cmake_ignore_path
.
and on system there 3 gcc compilers in path
(just make sure start empty binary output directory each try):
> cmake -g"ninja" .. ... -- check working c compiler: c:/mingw/bin/cc.exe ...
> cmake -dcmake_ignore_path="c:/mingw/bin" -g"ninja" .. ... -- check working c compiler: c:/strawberry/c/bin/gcc.exe ...
> cmake -dcmake_ignore_path="c:/mingw/bin;c:/strawberry/c/bin" -g"ninja" .. ... -- check working c compiler: c:/program files (x86)/llvm/bin/clang.exe ...
> cmake -dcmake_ignore_path="c:/mingw/bin;c:/strawberry/c/bin;c:/program files (x86)/llvm/bin" -g"ninja" .. ... -- check working c compiler: c:/program files (x86)/microsoft visual studio 14.0/vc/bin/cl.exe ...
Comments
Post a Comment