[CMake] Common language runtime

J Decker d3ck0r at gmail.com
Fri Dec 5 16:38:47 EST 2014


To enable compiling as/with CLR...

SET_TARGET_PROPERTIES(bag PROPERTIES
                  COMPILE_FLAGS  "/CLR" )
# need to set unicode characters...
add_definitions( -D_UNICODE -DUNICODE )

    string( REPLACE "/EHsc" "" CMAKE_CXX_FLAGS_INIT ${CMAKE_CXX_FLAGS_INIT}
)
    string( REPLACE "/EHsc" "" CMAKE_C_FLAGS_INIT ${CMAKE_C_FLAGS_INIT} )
    string( REPLACE "/EHs" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS_INIT} )
    string( REPLACE "/EHs" "" CMAKE_C_FLAGS_INIT ${CMAKE_C_FLAGS_INIT} )
    string( REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG
${CMAKE_CXX_FLAGS_DEBUG} )
    # cannot set CLR for C code anyway; only C++
    #string( REPLACE "/RTC1" "/CLR" CMAKE_C_FLAGS_DEBUG
${CMAKE_C_FLAGS_DEBUG} )


    set( FORCE_CXX ON )
force_cxx flag also forces compiling C as C++.....

set_source_files_properties(${_SOURCES} PROPERTIES LANGUAGE CXX )



On Fri, Dec 5, 2014 at 1:11 PM, Apoorva Gaddagimath <
apoorva.gaddagimath at markit.com> wrote:

>  Hi everyone,
>
> I’m trying to add a .NET assembly reference to my CMake project. Various
> forums on Google suggested to use /clr. The problem I've found, is that
> while CMake sets the "Common Language RunTime Support" option in the C/C++
> section of the configuration properties if "/clr" is in the CXX_FLAGS, it
> does not set the "Common Language RunTime Support" in the general
> configuration properties, and that causes problems with linking .NET
> references. Is there a different way to do this or a different approach>
> Would greatly appreciate any help on this.
>
>
>
> Thanks
>
>
>
> Apoorva Gaddagimath
>
> Software Engineer
>
> Markit On Demand
>
>
>
> Markit
>
>
>
> 5718 Central Avenue
>
> Boulder, CO 80301
>
> +1 720-648-4907
>
> apoorva.gaddagimath at markit.com
>
> www.markit.com
>
>
>
> ------------------------------
>
> This e-mail, including accompanying communications and attachments, is
> strictly confidential and only for the intended recipient. Any retention,
> use or disclosure not expressly authorised by Markit is prohibited. This
> email is subject to all waivers and other terms at the following link:
> http://www.markit.com/en/about/legal/email-disclaimer.page
>
> Please visit http://www.markit.com/en/about/contact/contact-us.page for
> contact information on our offices worldwide.
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141205/837db2f9/attachment-0001.html>


More information about the CMake mailing list