[CMake] MSVC /M[TD]<d> as a compatible interface property?

Walter Gray chrysalisx at gmail.com
Thu Jun 9 16:58:48 EDT 2016


Setting /MT or /MD is pretty important, and is a transitive requirement.
See: https://msdn.microsoft.com/en-us/library/2kzt1wy3(VS.80).aspx

The standard mechanism of using target_compile_options isn't quite
appropriate because it will simply append the flags used by each library
and use the last one with no complaint if there is a mismatch.

Example:
A uses /MT, B uses /MD, C Depends on both.
This will result in errors when compiling, but will configure just fine. I
would like to make it so that if there is a mismatch between linked
targets, cmake will either fail or issue a warning.

https://cmake.org/cmake/help/v3.5/manual/cmake-buildsystem.7.html#compatible-interface-properties
This seems to be meant to be used for exactly this type of thing, but
because there is no specific property for specifying MSVC_RUNTIME, that
system cannot be used in this case.

Any thoughts on how to address this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160609/69e40f2e/attachment.html>


More information about the CMake mailing list