I have a project for which I am creating a static and dynamic version of libraries. The tools are tied to the static version; therefore, to run them on the final system, special DLLs are not required.
I can configure everything I need to compile with / MD or /MT (and corresponding debugging) with a simple set in the CMakeLists.txt root file.
For example, for force / MT, I can use the following:
set ( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" ) set ( CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /MT" ) set ( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /MTd" ) set ( CMAKE_C_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_RELEASE} /MTd" )
However, this means that dynamic libraries are compiled with /MT , which is not true. Is it possible to do the same thing for each project? In the end, once the solution is created, I can edit each project and fix the /MD and /MT objects according to what I need. Can it do this? That would be convenient.
I looked at set_target_properties() , but does not seem to accept CMAKE_C_FLAGS_<type> variables, and if I just set the standard set of flags, it would not be specific to Debug or Release.
The following sets the property, but I have no choice for debug and release options.
set_target_properties( ${PROJECT_NAME} PROPERTIES COMPILE_FLAGS "/MT" )
Any solution?
static dll visual-studio-2012 cmake
Alexis Wilke Aug 05 '13 at 18:37 2013-08-05 18:37
source share