[CMake] Staticly Link to VC++ Runtime

Mike Jackson mike.jackson at imts.us
Fri Jul 18 07:57:40 EDT 2008



On Jul 18, 2008, at 5:43 AM, Yuri Timenkov wrote:

> On Friday 18 July 2008 13:33:59 Mike Arthur wrote:
>> I'm trying to distribute my application to Windows users and am  
>> getting
>> some fairly horrendous grief with manifests.
>>
>> Can anyone advise how I'd get CMake to statictly link against the  
>> msvc*.dll
>> files that my application needs when compiled with MSVC++?
> According to MSDN you have 2 options:
> 1) add _STATIC_CPPLIB define.
> 2) Change compiler flags /MD -> /MT, /MDd -> /MTd (look into
> CMAKE_CXX_FLAGS_*)
>
>>
>> Thanks!
>
>

Is CMake NOT generating the manifests for you?

I think I had to create some "install" rules and then run the  
"Install" project inside the solution. The installation should  
include all the necessary msvc.dll stuff that is needed. I use MSVC  
2005 Pro.

IF (WIN32)
   INSTALL(TARGETS ${HDFViewer_EXE_NAME}
   LIBRARY DESTINATION lib
   ARCHIVE DESTINATION lib
   RUNTIME DESTINATION bin
   )
INCLUDE (InstallRequiredSystemLibraries)
ENDIF (WIN32)

-- 
Mike Jackson   Senior Research Engineer
Innovative Management & Technology Services



More information about the CMake mailing list