vcpkg/ports/nethost/0001-nethost-cmakelists.patch
Lanyi 2aed520ed7
[nethost] Update nethost (#25004)
* update nethost

* bump nethost version

* Add CMake exports in an unofficial- namespace
https://github.com/microsoft/vcpkg/blob/master/docs/maintainers/maintainer-guide.md#add-cmake-exports-in-an-unofficial--namespace

* fix port version and deprecated functions

* change nethost version date to version

* update usage

* add quotes to paths and export targets directly

* bump nethost version

* [nethost] Only build one flavor

* fix build error

* bump nethost version

Co-authored-by: Robert Schumacher <roschuma@microsoft.com>
2022-06-02 15:20:55 -07:00

74 lines
2.5 KiB
Diff

diff --git a/src/native/corehost/nethost/CMakeLists.txt b/src/native/corehost/nethost/CMakeLists.txt
index a9f44e720..0f24d4458 100644
--- a/src/native/corehost/nethost/CMakeLists.txt
+++ b/src/native/corehost/nethost/CMakeLists.txt
@@ -1,11 +1,14 @@
# Licensed to the .NET Foundation under one or more agreements.
# The .NET Foundation licenses this file to you under the MIT license.
+cmake_minimum_required (VERSION 3.14.5)
project(nethost)
set(DOTNET_PROJECT_NAME "nethost")
# Include directories
+include(../../../../eng/native/configurepaths.cmake)
+include("${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake")
include_directories(../fxr)
# CMake does not recommend using globbing since it messes with the freshness checks
@@ -19,12 +22,23 @@ if(CLR_CMAKE_TARGET_WIN32)
Exports.def)
endif()
+if(BUILD_SHARED_LIBS)
include(../lib.cmake)
+set(targets nethost)
+else()
+include(../hostmisc/hostmisc.cmake)
include(../lib_static.cmake)
+add_library(nethost INTERFACE)
+target_link_libraries(nethost INTERFACE libnethost)
+set(targets libnethost nethost)
+target_include_directories(libnethost INTERFACE $<INSTALL_INTERFACE:include>)
+endif()
+target_include_directories(nethost INTERFACE $<INSTALL_INTERFACE:include>)
add_definitions(-DFEATURE_LIBHOST=1)
add_definitions(-DNETHOST_EXPORT)
+if(NOT BUILD_SHARED_LIBS)
# Copy static lib PDB to the project output directory
if (WIN32)
set_target_properties(libnethost PROPERTIES
@@ -32,15 +46,18 @@ if (WIN32)
COMPILE_PDB_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
)
endif(WIN32)
+endif()
-install(FILES ../coreclr_delegates.h DESTINATION corehost)
-install(FILES ../hostfxr.h DESTINATION corehost)
-install(FILES nethost.h DESTINATION corehost)
-install_with_stripped_symbols(nethost TARGETS corehost)
+set(NETHOST_HEADERS nethost.h ../coreclr_delegates.h ../hostfxr.h)
+install(FILES ${NETHOST_HEADERS} DESTINATION include)
+install(TARGETS ${targets} EXPORT unofficial-nethost-config
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+ RUNTIME DESTINATION bin
+)
-# Only Windows creates a symbols file for static libs.
-if (WIN32)
- install_with_stripped_symbols(libnethost TARGETS corehost)
-else()
- install(TARGETS libnethost DESTINATION corehost)
-endif(WIN32)
\ No newline at end of file
+install(EXPORT unofficial-nethost-config
+ DESTINATION share/unofficial-nethost
+ FILE unofficial-nethost-config.cmake
+ NAMESPACE unofficial::nethost::
+)