Why couldn't CMake set COMMON_LANGUAGE_RUNTIME up successfully

Viewed 401

I have a shared library written in C++, and I would like to call it from C#. After some investigation, I decided to use C++/CLI to achieve this goal. However, setting Common Language Runtime Support with CMake, isn't working.

Here is my CMakeLists.txt:

set(CLR_HEADERS
    ${CMAKE_SOURCE_DIR}/clr/Refer.h
    ${CMAKE_SOURCE_DIR}/clr/Wrapper.h)

add_library(CLR_COM SHARED ${CLR_HEADERS})

target_include_directories(CLR_COM
    PRIVATE ${CMAKE_SOURCE_DIR}/include
            ${CMAKE_SOURCE_DIR}/clr)

set_target_properties(CLR_COM
    PROPERTIES COMMON_LANGUAGE_RUNTIME            ""
               VS_DOTNET_REFERENCES               "System"
               VS_DOTNET_TARGET_FRAMEWORK_VERSION "v4.6")

Although VS_DOTNET_TARGET_FRAMEWORK_VERSION is setted successfully, the COMMON_LANGUAGE_RUNTIME is still invalid.

The generated properties of the visual studio project

0 Answers
Related