Make `dependency('foo', static: true, method: 'cmake') link statically

Fixes #1709
pull/11778/head
Volker Weißmann 2 years ago committed by Jussi Pakkanen
parent 2699fd4b8a
commit a8b144b71b
  1. 1
      mesonbuild/dependencies/cmake.py
  2. 4
      mesonbuild/dependencies/data/CMakeLists.txt
  3. 3
      test cases/rust/13 external c dependencies/test.json

@ -388,6 +388,7 @@ class CMakeDependency(ExternalDependency):
cmake_opts += ['-DARCHS={}'.format(';'.join(self.cmakeinfo.archs))]
cmake_opts += [f'-DVERSION={package_version}']
cmake_opts += ['-DCOMPS={}'.format(';'.join([x[0] for x in comp_mapped]))]
cmake_opts += [f'-DSTATIC={self.static}']
cmake_opts += args
cmake_opts += self.traceparser.trace_args()
cmake_opts += toolchain.get_cmake_args()

@ -8,6 +8,10 @@ set(PACKAGE_FOUND FALSE)
set(_packageName "${NAME}")
string(TOUPPER "${_packageName}" PACKAGE_NAME)
if("${STATIC}" STREQUAL "True")
set("${NAME}_USE_STATIC_LIBS" "ON")
endif()
while(TRUE)
if ("${VERSION}" STREQUAL "")
find_package("${NAME}" QUIET COMPONENTS ${COMPS})

@ -12,7 +12,8 @@
]
},
"exclude": [
{ "static": true, "method": "pkg-config" }
{ "static": true, "method": "pkg-config" },
{ "static": true, "method": "cmake" }
]
}
}

Loading…
Cancel
Save