# Generator expressions for IMPORTED\_IMPLIB/LOCATION properties?

**URL:** <https://discourse.cmake.org/t/generator-expressions-for-imported-implib-location-properties/4564>\
**Category:** Code\
**Created:** [November 28, 2021, 2:17am UTC](https://discourse.cmake.org/t/generator-expressions-for-imported-implib-location-properties/4564 "2021-11-28T02:17:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![kfsone](https://discourse.cmake.org/user_avatar/discourse.cmake.org/kfsone/32/1880_2.png) [@kfsone](https://discourse.cmake.org/u/kfsone)\
**Post date:** [November 28, 2021, 2:17am UTC](https://discourse.cmake.org/t/generator-expressions-for-imported-implib-location-properties/4564/1 "2021-11-28T02:17:28Z")

</div>

CMake 3.21:

I’m trying to wrap fmod with a SHARED IMPORTED target and support Windows builds. The .lib name depends on bitness and build type, as does the dll, but the IMPORTED\_IMPLIB and IMPORTED\_LOCATION properties don’t appear to take generator expressions.

```auto
SET_PARGET_PROPERTIES(
    ExternFMOD
    PROPERTIES
        IMPORTED_IMPLIB "${_fmod_lib_dir}/$<IF:$<CONFIG:Debug>,fmodL64_vc.lib,fmod64_vc.lib>"
        IMPORTED_LOCATION "${_fmod_lib_dir}/$<IF:$<CONFIG:Debug>,fmodL64.dll,fmod64.dll>"
)

```

fails:

```auto
LINK : fatal error LNK1104: cannot open file '...\lib\$<IF:$<CONFIG:Debug>,fmodL64_vc.lib,fmod64_vc.lib>' ...

```

It doesn’t appear to allow the old ‘optimized’ or ‘debug’ patterns, either.

This approach seems to be dead in the water without explicit generator expression support for IMPLIB\_ properties?

---

<div class="post-metadata">

**Author:** ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)\
**Post date:** [November 28, 2021, 9:59am UTC](https://discourse.cmake.org/t/generator-expressions-for-imported-implib-location-properties/4564/2 "2021-11-28T09:59:51Z")

</div>

You can use specialized properties for some configurations: [IMPORTED\_IMPLIB\_\<CONFIG\>](https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_IMPLIB_CONFIG.html) and [IMPORTED\_LOCATION\_\<CONFIG\>](https://cmake.org/cmake/help/latest/prop_tgt/IMPORTED_LOCATION_CONFIG.html).

```cmake
SET_PARGET_PROPERTIES(
    ExternFMOD
    PROPERTIES
        IMPORTED_IMPLIB_DEBUG "${_fmod_lib_dir}/fmodL64_vc.lib"
        IMPORTED_IMPLIB "${_fmod_lib_dir}/fmod64_vc.lib"
        IMPORTED_LOCATION_DEBUG "${_fmod_lib_dir}/fmodL64.dll"
        IMPORTED_LOCATION "${_fmod_lib_dir}/fmod64.dll"
)

```
