POCO: can not set the postfix

I am using CMake to build POCO, and it suceed.

Then, I want to install it. Befor installation, I want to set the postfix:

I set CMAKE_RELWITHDEBINFO_POSTFIX as from " " to “rd”, then configure again.

The stranger thing is that the CMAKE_RELWITHDEBINFO_POSTFIX automatically change to be " ":

Why this happen? How can I correctly set the postfix? Any suggestion is appreciated!

The project itself could be changing this on you. Does the project set any POSTFIX cache variables anywhere? I don’t see anything in the code with GitHub’s search, but does cmake --trace-expand output show anything like it?

I do not change anything. What I have done is: downloading POCO, and cmake it.

The environment is:

win 10 
vs 2022
cmake 3.22.1

Can you reproduce this phenomenon?

I don’t know how to use cmake --trace-expand because the system operation is win10.

The file poco/DefinePlatformSpecifc.cmake at master · pocoproject/poco · GitHub seems to override the cached values:

# Add a d postfix to the debug libraries
if(BUILD_SHARED_LIBS)
	set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Set Debug library postfix" FORCE)
	set(CMAKE_RELEASE_POSTFIX "" CACHE STRING "Set Release library postfix" FORCE)
	set(CMAKE_MINSIZEREL_POSTFIX "" CACHE STRING "Set MinSizeRel library postfix" FORCE)
	set(CMAKE_RELWITHDEBINFO_POSTFIX "" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
else(BUILD_SHARED_LIBS)
	set(CMAKE_DEBUG_POSTFIX "${STATIC_POSTFIX}d" CACHE STRING "Set Debug library postfix" FORCE)
	set(CMAKE_RELEASE_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set Release library postfix" FORCE)
	set(CMAKE_MINSIZEREL_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set MinSizeRel library postfix" FORCE)
	set(CMAKE_RELWITHDEBINFO_POSTFIX "${STATIC_POSTFIX}" CACHE STRING "Set RelWithDebInfo library postfix" FORCE)
endif()
1 Like

Is that means that the changing in CMake GUI is useless?

If I want to set the CMAKE_RELWITHDEBINFO_POSTFIX as “rd”, should I change the DefinePlatformSpecifc.cmake rather than change the CMake GUI?

For that project, yes. The project is ignoring your setting with that FORCE.

Thank you very much for your kindly reply. I will modify the CMAKE_RELWITHDEBINFO_POSTFIX according to my need.