diff --git a/contrib/depends/Makefile b/contrib/depends/Makefile index 5f93075db5..8dfd9e8d9c 100644 --- a/contrib/depends/Makefile +++ b/contrib/depends/Makefile @@ -152,6 +152,7 @@ $(host_prefix)/share/toolchain.cmake : toolchain.cmake.in $(host_prefix)/.stamp_ -e 's|@release_type@|$(cmake_release_type)|' \ -e 's|@build_tests@|$(build_tests)|' \ -e 's|@cmake_system_name@|$($(host_os)_cmake_system)|' \ + -e 's|@cmake_system_version@|$($(host_os)_cmake_system_version)|' \ -e 's|@prefix@|$($(host_arch)_$(host_os)_prefix)|'\ -e 's|@arch@|$(host_arch)|'\ $< > $@ diff --git a/contrib/depends/funcs.mk b/contrib/depends/funcs.mk index 54cdf42e7f..70b284861b 100644 --- a/contrib/depends/funcs.mk +++ b/contrib/depends/funcs.mk @@ -153,6 +153,7 @@ $(1)_stage_env+=$($(1)_stage_env_$(host_arch)_$(host_os)) $($(1)_stage_env_$(hos $(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig $(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig +$(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake $(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)" $(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)" @@ -185,6 +186,25 @@ endif ifneq ($($(1)_ldflags),) $(1)_autoconf += LDFLAGS="$$($(1)_ldflags)" endif + +$(1)_cmake=env CC="$$($(1)_cc)" \ + CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \ + CXX="$$($(1)_cxx)" \ + CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \ + LDFLAGS="$$($(1)_ldflags)" \ + cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_config_opts) +ifeq ($($(1)_type),build) +$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib" +else +ifneq ($(host),$(build)) +$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system) +$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host) +$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host) +ifneq ($($(host_os)_cmake_system_version),) +$(1)_cmake += -DCMAKE_SYSTEM_VERSION=$($(host_os)_cmake_system_version) +endif +endif +endif endef define int_add_cmds diff --git a/contrib/depends/hosts/mingw32.mk b/contrib/depends/hosts/mingw32.mk index 58a9a929de..2eb5fbda02 100644 --- a/contrib/depends/hosts/mingw32.mk +++ b/contrib/depends/hosts/mingw32.mk @@ -11,3 +11,4 @@ mingw32_debug_CXXFLAGS=$(mingw32_debug_CFLAGS) mingw32_debug_CPPFLAGS=-D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC mingw32_cmake_system=Windows +mingw32_cmake_system_version=10.0 diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk index 254636bca5..f1c600d624 100644 --- a/contrib/depends/packages/unbound.mk +++ b/contrib/depends/packages/unbound.mk @@ -15,7 +15,6 @@ define $(package)_set_vars $(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix) $(package)_config_opts_x86_64_darwin=ac_cv_func_SHA384_Init=yes $(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread" - $(package)_cflags_mingw32+="-D_WIN32_WINNT=0x600" endef define $(package)_preprocess_cmds diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index eb0da1877d..9a3ebcb1bb 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -1,5 +1,6 @@ # Set the system name to one of Android, Darwin, FreeBSD, Linux, or Windows SET(CMAKE_SYSTEM_NAME @cmake_system_name@) +SET(CMAKE_SYSTEM_VERSION @cmake_system_version@) SET(CMAKE_SYSTEM_PROCESSOR @arch@) SET(CMAKE_BUILD_TYPE @release_type@)