# How to set the parameters of cmake\_ranlib?

**URL:** <https://discourse.cmake.org/t/how-to-set-the-parameters-of-cmake-ranlib/8112>\
**Category:** Code\
**Tags:** os:linux\
**Created:** [May 13, 2023, 7:35am UTC](https://discourse.cmake.org/t/how-to-set-the-parameters-of-cmake-ranlib/8112 "2023-05-13T07:35:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![TornadoMan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tornadoman/32/3432_2.png) [@TornadoMan](https://discourse.cmake.org/u/TornadoMan)\
**Post date:** [May 13, 2023, 7:36am UTC](https://discourse.cmake.org/t/how-to-set-the-parameters-of-cmake-ranlib/8112/1 "2023-05-13T07:36:00Z")

</div>

For binary consistency, parameters ‘-D’ need to be set to cmake\_ranlib, I tried the following but it didn’t work

SET(CMAKE\_C\_COMPILER\_RANLIB “\<CMAKE\_RANLIB\> -D ”)  
SET(CMAKE\_CXX\_COMPILER\_RANLIB “\<CMAKE\_RANLIB\> -D ”)

---

<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:** [May 13, 2023, 1:03pm UTC](https://discourse.cmake.org/t/how-to-set-the-parameters-of-cmake-ranlib/8112/2 "2023-05-13T13:03:29Z")

</div>

Does it work if you add to `CMAKE_STATIC_LINKER_FLAGS` instead?

---

<div class="post-metadata">

**Author:** ![TornadoMan](https://discourse.cmake.org/user_avatar/discourse.cmake.org/tornadoman/32/3432_2.png) [@TornadoMan](https://discourse.cmake.org/u/TornadoMan)\
**Post date:** [May 15, 2023, 1:26am UTC](https://discourse.cmake.org/t/how-to-set-the-parameters-of-cmake-ranlib/8112/3 "2023-05-15T01:26:03Z")

</div>

thank you for ask， i tried this worked， CMAKE\_STATIC\_LINKER\_FLAGS can be tried letter  
SET(CMAKE\_C\_ARCHIVE\_FINISH “\<CMAKE\_RANLIB\> -D ”)  
SET(CMAKE\_CXX\_ARCHIVE\_FINISH “\<CMAKE\_RANLIB\> -D ”)
