Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Scott_S_2
Beginner
130 Views

/MD flag

Hi,

 

I'm trying to get a windows build using oneAPI going but the libs I'm trying to include use /MD rather than /MT.  Adding the /MD via cmake doesn't show up in the resultant msvc solution.  I can add it manually via the additional options box, but this gets wiped every time I regenerate the cmake.  Am I missing something?

 

Thanks
Scott

Tags (1)
0 Kudos
5 Replies
AbhishekD_Intel
Moderator
130 Views

Hi,

With the Visual Studio Generators, a native build system may choose to add its own default runtime library selection flag. So try to set the same value in the visual studio which you want to use. And you also have to specify the same value in CMake.

If your CMake has a different value you can replace it with what you want, but your visual studio and CMake value should be the same.

 

Warm Regards,

Abhishek

 

Scott_S_2
Beginner
130 Views

I was setting the /MD flag in cmake via SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}  /MD) but that doesn't set the correct runtime in the resultant visual studio solution.

Using set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL") does set the visual studio solution correctly.

Cheers
Scott

AbhishekD_Intel
Moderator
130 Views

Hi,

Glad to know that your issue is resolved.

Please confirm for us if we can close this thread. You can always open a new thread if you face any issue.

 

Warm Regards,

Abhishek

Scott_S_2
Beginner
130 Views

you can close the thread now.

AbhishekD_Intel
Moderator
130 Views

Hi Scott,

Thank you we are closing the thread.

You can also go through cmake-generator-expressions and can specify MSVC_RUNTIME_LIBRARY values using them for more details.

 

Warm Regards,

Abhishek

Reply