For MSVC I use something like this to allow linking statically to the
C/C++ runtime:
IF(MSVC)
SET(LINK_STATIC_RUNTIME OFF CACHE BOOL "Link statically against
C/C++ runtime")
IF(LINK_STATIC_RUNTIME)
foreach(cfgtype ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
Hi!
For GNU/MinGW gcc i do use this:
# MinGW / GNU Compiler
IF( ${CMAKE_COMPILER_IS_GNUCXX} )
# link libstdc++ and others statically
SET (CMAKE_EXE_LINKER_FLAGS"-static-libstdc++ -static-libgcc
--disable-shared --enable-static --static")
ENDIF( ${CMAKE_COMPILER_IS_GNUCXX} )
Regards,
Flori
Hi,
I'm surprised to see that there is no optional [STATIC] argument in
add_executable cmake command. I think it should be very important to
have this because a lot of people like having static binaries.
Thus for the moment what is the best way and more portable way to set a
binary to be bui