Skip to content

Commit 8845b38

Browse files
committed
Merge #19685: depends: CMake invocation cleanup
b893688 depends: Specify LDFLAGS to cmake as well (Carl Dong) b3f541f depends: Prepend CPPFLAGS to C{,XX}FLAGS for CMake (Carl Dong) 8e121e5 depends: Cleanup CMake invocation (Carl Dong) 8c7cd0c depends: More robust cmake invocation (Carl Dong) 3ecf0ec depends: Use $($(package)_cmake) instead of cmake (Carl Dong) Pull request description: - Use `$($(package)_cmake)` instead of invoking `cmake` directly - Use well-known env vars instead of overriding CMake variables ACKs for top commit: ryanofsky: Code review ACK b893688. Only changes since last review are new commits adding whitespace, cppflags and ldflags to cmake invocation Tree-SHA512: cfcd8cc9dcd0b336cf48b82fca9fe4bbc7930ed397cb7a68a07066680eb4c1906a6a9b5bd2589b4b4999e8f16232fa30ee9b376b60f4456d0fff931fbf9cc19a
2 parents c17a003 + b893688 commit 8845b38

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

depends/funcs.mk

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,17 @@ ifneq ($($(1)_ldflags),)
157157
$(1)_autoconf += LDFLAGS="$$($(1)_ldflags)"
158158
endif
159159

160-
$(1)_cmake=cmake -DCMAKE_INSTALL_PREFIX=$($($(1)_type)_prefix)
160+
$(1)_cmake=env CC="$$($(1)_cc)" \
161+
CFLAGS="$$($(1)_cppflags) $$($(1)_cflags)" \
162+
CXX="$$($(1)_cxx)" \
163+
CXXFLAGS="$$($(1)_cppflags) $$($(1)_cxxflags)" \
164+
LDFLAGS="$$($(1)_ldflags)" \
165+
cmake -DCMAKE_INSTALL_PREFIX:PATH="$$($($(1)_type)_prefix)"
161166
ifneq ($($(1)_type),build)
162167
ifneq ($(host),$(build))
163-
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system) -DCMAKE_SYSROOT=$(host_prefix)
164-
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host) -DCMAKE_C_COMPILER=$(firstword $($($(1)_type)_CC)) -DCMAKE_C_FLAGS="$(wordlist 2,1000,$($($(1)_type)_CC))"
165-
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host) -DCMAKE_CXX_COMPILER=$(firstword $($($(1)_type)_CXX)) -DCMAKE_CXX_FLAGS="$(wordlist 2,1000,$($($(1)_type)_CXX))"
168+
$(1)_cmake += -DCMAKE_SYSTEM_NAME=$($(host_os)_cmake_system)
169+
$(1)_cmake += -DCMAKE_C_COMPILER_TARGET=$(host)
170+
$(1)_cmake += -DCMAKE_CXX_COMPILER_TARGET=$(host)
166171
endif
167172
endif
168173
endef

depends/packages/native_cdrkit.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ endef
1212
# Starting with 10.1, GCC defaults to -fno-common, resulting in linking errors.
1313
# Pass -fcommon to retain the legacy behaviour.
1414
define $(package)_config_cmds
15-
cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix) -DCMAKE_C_FLAGS="-fcommon"
15+
$($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -fcommon"
1616
endef
1717

1818
define $(package)_build_cmds

depends/packages/native_libdmg-hfsplus.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define $(package)_preprocess_cmds
1212
endef
1313

1414
define $(package)_config_cmds
15-
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix) -DCMAKE_C_FLAGS="-Wl,--build-id=none" ..
15+
$($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -Wl,--build-id=none" ..
1616
endef
1717

1818
define $(package)_build_cmds

0 commit comments

Comments
 (0)