# testing for library build type for packaging purposes

**URL:** https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940
**Category:** Usage
**Created:** [November 23, 2022, 11:54am UTC](https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940 "2022-11-23T11:54:01Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![giallu](https://discourse.cmake.org/user_avatar/discourse.cmake.org/giallu/32/1938_2.png) [@giallu](https://discourse.cmake.org/u/giallu)
#### Post date: [November 23, 2022, 11:54am UTC](https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940/1 "2022-11-23T11:54:01Z")

</div>

I use vcpkg to install few external dependencies (zlib, pthreads, etc) for my projects, then pick them up with find\_package() calls; sometimes I want to link them statically and vcpkg makes this easy by allowing me to use something like `-D VCPKG_TARGET_TRIPLET=x64-windows-static` on the cmake command line.

However, when it comes to packaging the whole project if I use something like this:

```auto
install (
    FILES
    ${PThreads4W_LIBRARY_RELEASE_DLL}
    DESTINATION .
    COMPONENT my-component
)

```

it breaks when I use the static version of libraries.

Is there a way to test how the library I am importing is built? I’ve found that targets have a “STATIC\_LIBRARY” property ([https://cmake.org/cmake/help/latest/prop\_tgt/TYPE.html](https://cmake.org/cmake/help/latest/prop_tgt/TYPE.html)) but it seems I am not able to query it, for instance this fails:

```auto
get_target_property(LINK_TYPE ZLIB::ZLIB TYPE)
message("LINK TYPE: " "${LINK_TYPE}")

```

like this:

```auto
CMake Error at dist/CMakeLists.txt:124 (get_target_property):
  get_target_property() called with non-existent target "ZLIB::ZLIB".

```

Ideas?

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 23, 2022, 11:17pm UTC](https://discourse.cmake.org/t/testing-for-library-build-type-for-packaging-purposes/6940/2 "2022-11-23T23:17:09Z")

</div>

I have [this MR](https://gitlab.kitware.com/cmake/cmake/-/merge_requests/5820) which I need to get back to at some point.
