diff --git a/eng/native/ijw/IJW.cmake b/eng/native/ijw/IJW.cmake index f606b5e98889fe..81b69f0d965d2c 100644 --- a/eng/native/ijw/IJW.cmake +++ b/eng/native/ijw/IJW.cmake @@ -31,8 +31,21 @@ if (CLR_CMAKE_HOST_WIN32) set_target_properties(${targetName} PROPERTIES COMPILE_OPTIONS "${compileOptions}") endfunction() + function(add_ijw_msbuild_project_properties targetName ijwhost_target) + # When we're building with MSBuild, we need to set some project properties + # in case CMake has decided to use the SDK support. + # We're dogfooding things, so we need to set settings in ways that the product doesn't quite support. + # We don't actually need an installed/available target framework version here + # since we are disabling implicit framework references. We just need a valid value, and net7.0 is valid. + set_target_properties(${targetName} PROPERTIES + DOTNET_TARGET_FRAMEWORK net7.0 + VS_GLOBAL_DisableImplicitFrameworkReferences true + VS_GLOBAL_GenerateRuntimeConfigurationFiles false + VS_PROJECT_IMPORT "${CMAKE_CURRENT_FUNCTION_LIST_DIR}/SetIJWProperties.props") + endfunction() + # 4365 - signed/unsigned mismatch - # 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces. + # 4679 - Could not import member. This is an issue with IJW and static abstract methods in interfaces. add_compile_options(/wd4365 /wd4679) # IJW diff --git a/eng/native/ijw/SetIJWProperties.props b/eng/native/ijw/SetIJWProperties.props new file mode 100644 index 00000000000000..d18ba7ff054fc2 --- /dev/null +++ b/eng/native/ijw/SetIJWProperties.props @@ -0,0 +1,6 @@ + + + + false + + \ No newline at end of file diff --git a/src/native/corehost/test/ijw/CMakeLists.txt b/src/native/corehost/test/ijw/CMakeLists.txt index d360314fb7fa1b..a9223b4e8d75e3 100644 --- a/src/native/corehost/test/ijw/CMakeLists.txt +++ b/src/native/corehost/test/ijw/CMakeLists.txt @@ -12,5 +12,6 @@ add_library(ijw SHARED ${SOURCES}) target_link_libraries(ijw ${LINK_LIBRARIES_ADDITIONAL}) remove_ijw_incompatible_target_options(ijw) +add_ijw_msbuild_project_properties(ijw ijwhost) install_with_stripped_symbols(ijw TARGETS corehost_test) \ No newline at end of file diff --git a/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt b/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt index 92085fcc778acd..735be8ce9d327e 100644 --- a/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt +++ b/src/tests/Interop/IJW/CopyConstructorMarshaler/CMakeLists.txt @@ -7,6 +7,7 @@ set(SOURCES IjwCopyConstructorMarshaler.cpp) # add the shared library add_library (IjwCopyConstructorMarshaler SHARED ${SOURCES}) target_link_libraries(IjwCopyConstructorMarshaler ${LINK_LIBRARIES_ADDITIONAL}) +add_ijw_msbuild_project_properties(IjwCopyConstructorMarshaler ijwhost) # add the install targets install (TARGETS IjwCopyConstructorMarshaler DESTINATION bin) diff --git a/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt b/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt index 93d8a676af254f..27f9bad93f10b3 100644 --- a/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt +++ b/src/tests/Interop/IJW/IjwNativeDll/CMakeLists.txt @@ -7,6 +7,7 @@ set(SOURCES IjwNativeDll.cpp) # add the shared library add_library (IjwNativeDll SHARED ${SOURCES}) target_link_libraries(IjwNativeDll ${LINK_LIBRARIES_ADDITIONAL}) +add_ijw_msbuild_project_properties(IjwNativeDll ijwhost) # add the install targets install (TARGETS IjwNativeDll DESTINATION bin) diff --git a/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt b/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt index 5427431a31a381..588f8b2625592b 100644 --- a/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt +++ b/src/tests/Interop/IJW/NativeVarargs/CMakeLists.txt @@ -7,6 +7,7 @@ set(SOURCES IjwNativeVarargs.cpp) # add the shared library add_library (IjwNativeVarargs SHARED ${SOURCES}) target_link_libraries(IjwNativeVarargs ${LINK_LIBRARIES_ADDITIONAL}) +add_ijw_msbuild_project_properties(IjwNativeVarargs ijwhost) # add the install targets install (TARGETS IjwNativeVarargs DESTINATION bin)