How to append prefix to program and library in the command line?

For my own solution:

# inject.cmake
string(TOLOWER "${PROJECT_NAME}" LIB_PREFIX)
set(LIB_PREFIX "${LIB_PREFIX}-")
set(CMAKE_SHARED_LIBRARY_PREFIX "${LIB_PREFIX}")
# Other codes uses LIB_PREFIX

And then apply -DCMAKE_PROJECT_INCLUDE="${srcdir}/inject.cmake" to cmake command.
It’s strange that I can’t just use -DCMAKE_SHARED_LIBRARY_PREFIX directly.
Thanks for the inspiration.