# How to use CMAKE\_SHARED\_LIBRARY\_PREFIX in command line?

**URL:** https://discourse.cmake.org/t/how-to-use-cmake-shared-library-prefix-in-command-line/11410
**Category:** Usage
**Created:** [August 8, 2024, 12:49pm UTC](https://discourse.cmake.org/t/how-to-use-cmake-shared-library-prefix-in-command-line/11410 "2024-08-08T12:49:56Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![ikspress](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/i/ac8455/32.png) [@ikspress](https://discourse.cmake.org/u/ikspress)
#### Post date: [August 8, 2024, 12:49pm UTC](https://discourse.cmake.org/t/how-to-use-cmake-shared-library-prefix-in-command-line/11410/1 "2024-08-08T12:49:56Z")

</div>

I am trying to specify a prefix for a project to resolve naming conflicts issues. However, `CMAKE_SHARED_LIBRARY_PREFIX` only works within CMake scripts (set(CMAKE\_SHARED\_LIBRARY\_PREFIX …)) and not on the command line (-DCMAKE\_SHARED\_LIBRARY\_PREFIX=…). Is there any way to make it works correctly?

Additionally, is there a variable that serves as `CMAKE_EXECUTABLE_PREFIX` corresponding to `CMAKE_EXECUTABLE_SUFFIX`?

---

<div class="post-metadata">

### Author: ![craig.scott](https://discourse.cmake.org/user_avatar/discourse.cmake.org/craig.scott/32/20_2.png) [@craig.scott](https://discourse.cmake.org/u/craig.scott)
#### Post date: [August 9, 2024, 12:50am UTC](https://discourse.cmake.org/t/how-to-use-cmake-shared-library-prefix-in-command-line/11410/2 "2024-08-09T00:50:15Z")

</div>

`CMAKE_SHARED_LIBRARY_PREFIX` is not meant to be set by a project or the developer. It is meant to be set by CMake itself, or by a toolchain file, since it represents the behavior of the target system.
