C compiler identification is unknown despite setting CC and CXX variables

前端 未结 1 556
谎友^
谎友^ 2021-02-14 15:53

I\'m using the command:

    cmake CC=\"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\bin\\cl.exe\" 
CXX=\"C:\\Program Files (x86)\\Microsoft Visual          


        
1条回答
  •  长情又很酷
    2021-02-14 16:32

    The compiler can be selected by using the CC and CXX variables, but by it's much more complicated than using the -G (generator) parameter. For one, the slashes in the path must be Unix style (/) and they don't take effect after the first time CMake configuration is ran unless the cache is cleared.

    For a list of available generator options include the --help option

    The paths to the Boost library must also use Unix style slashes (/). Many of the commands will convert Windows paths, but when passing in definitions at the command-line you'll want to always use Unix style paths.

    Your command would change to the following:

    cmake -G "Visual Studio 12 2013 Win64" -DBOOST_ROOT="C:/local/boost_1_56_0" -DBOOST_LIBRARYDIR="C:/local/boost_1_56_0/lib64-msvc-12.0" ..

    You'll also want to make sure that your PATH environment variable is setup correctly for Visual Studio and x64. This can be done easily by opening a VS2013 x64 Native Tools Command Prompt using the command below:

    cmd /k "%VS120CoMNTOOLS%\..\..\VC\vcvarsall.bat" amd64
    

    In addition, you should make sure you're clearing out the cmake cache before you try. The easiest way to do this is to delete your cmake build folder, but you can also use the CMake-gui to clear the cache.

    0 讨论(0)
提交回复
热议问题