On Wed, Sep 30, 2009 at 06:18:04PM +0200, Tanguy Krotoff wrote:
> project(rimes_http_request)
>
> # Statically link with Visual C++ libraries
> if (MSVC)
> foreach (MODE "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
> string(REPLACE "/MD" "/MT" TMP "${CMAKE_C_FLAGS${MODE}}")
> set(CMAKE_C_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
> string(REPLACE "/MD" "/MT" TMP "${CMAKE_CXX_FLAGS${MODE}}")
> set(CMAKE_CXX_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
> endforeach (MODE)
> endif (MSVC)
> ##
>
> add_library(rimes_http_request SHARED rimes_http_request.cpp)
>
> # Revert to standard CMake Visual C++ flags
> # This does not work, command line for rimes_http_request still
> contains /MD instead of /MT
> # If I remove this part, all my projects get compiled with flag /MT
> if (MSVC)
> foreach (MODE "_DEBUG" "_MINSIZEREL" "_RELEASE" "_RELWITHDEBINFO")
> string(REPLACE "/MT" "/MD" TMP "${CMAKE_C_FLAGS${MODE}}")
> set(CMAKE_C_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
> string(REPLACE "/MT" "/MD" TMP "${CMAKE_CXX_FLAGS${MODE}}")
> set(CMAKE_CXX_FLAGS${MODE} "${TMP}" CACHE STRING "" FORCE)
> endforeach (MODE)
> endif (MSVC)
> ##
So the first change, where you change from /MD to /MT, does work, but
the second change, where you change /MT back to /MD, does not work?
When I do this trick, I don't mess with the value in the cache; I just
change CMAKE_C_FLAGS. So maybe remove the CACHE parts and see if that
helps?
tyler
_______________________________________________
Powered by www.kitware.com
Visit other Kitware open-source projects at
http://www.kitware.com/opensource/opensource.html
Please keep messages on-topic and check the CMake FAQ at:
http://www.cmake.org/Wiki/CMake_FAQ
Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake