Reputation: 1
I'm working on a windows machine with git bash as my terminal.
I have converted a Visual studio *.sln
file to CMake with the tool cmake-converter.exe
.
It produces several CMakeLists.txt
in different directories.
I want to use MSVC as my compiler but I'm building for an embedded x86 system.
I have pointed out the MSVC compiler in a separate toolchain file like this
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)
When printing I have used Ninja as generator like this.
$ cmake --toolchain=./msvc_toolchain.cmake -S . -B build -G "Ninja"
When I look in the generated build.ninja
I can see in FLAGS
a -MDd
that I don't have set in any cmake file. It looks strange with -MDd
and I guess it should be /MDd
.
I also want to change it to /MT
.
Does anybody know where this flag come from? Are they possible to change and how?
Here is my configuration output when I build.
$ cmake --toolchain=./msvc_toolchain.cmake -S . -B build -G "Ninja" -- The C compiler identification is MSVC 19.38.33141.0 -- The CXX compiler identification is MSVC 19.38.33141.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Professional/VC/Tools/MSVC/14.38.33130/bin/Hostx86/x86/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done
Hello Tsyvarev. Here are the files you asked about.
cmake_minimum_required(VERSION 3.16.0 FATAL_ERROR)
set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE)
project(Ninja_proj C CXX)
set(PROJECT_NAME Ninja_mini)
add_library(${PROJECT_NAME} STATIC ./n_test.cpp)
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)
int main(int argc char** argv)
{
if (argc == 2)
return 0;
else
return 1;
}
Upvotes: 0
Views: 41