Skip to content

Commit ea26db4

Browse files
committed
depends: add cmake config command
1 parent 941ecef commit ea26db4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

contrib/depends/funcs.mk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ $(1)_stage_env+=$($(1)_stage_env_$(host_arch)_$(host_os)) $($(1)_stage_env_$(hos
153153

154154
$(1)_config_env+=PKG_CONFIG_LIBDIR=$($($(1)_type)_prefix)/lib/pkgconfig
155155
$(1)_config_env+=PKG_CONFIG_PATH=$($($(1)_type)_prefix)/share/pkgconfig
156+
$(1)_config_env+=CMAKE_MODULE_PATH=$($($(1)_type)_prefix)/lib/cmake
156157
$(1)_config_env+=PATH="$(build_prefix)/bin:$(PATH)"
157158
$(1)_build_env+=PATH="$(build_prefix)/bin:$(PATH)"
158159
$(1)_stage_env+=PATH="$(build_prefix)/bin:$(PATH)"
@@ -185,6 +186,22 @@ endif
185186
ifneq ($($(1)_ldflags),)
186187
$(1)_autoconf += LDFLAGS="$$($(1)_ldflags)"
187188
endif
189+
190+
$(1)_cmake=env CC="$$($(1)_cc)" \
191+
CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \
192+
CXX="$$($(1)_cxx)" \
193+
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
194+
LDFLAGS="$$($(1)_ldflags)" \
195+
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)" $$($(1)_config_opts)
196+
ifeq ($($(1)_type),build)
197+
$(1)_cmake += -DCMAKE_INSTALL_RPATH:PATH="$$($($(1)_type)_prefix)/lib"
198+
else
199+
ifneq ($(host),$(build))
200+
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
201+
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
202+
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
203+
endif
204+
endif
188205
endef
189206

190207
define int_add_cmds

0 commit comments

Comments
 (0)