Celero icon indicating copy to clipboard operation
Celero copied to clipboard

CMAKE_<BUILD_TYPE>_POSTFIX spills into consuming project

Open ferkulat opened this issue 8 months ago • 1 comments

When celero is added to a project as dependency via FetchContent and built in the consuming project build, celeros explicit setting of CMAKE_<BUILD_TYPE>_POSTFIX spills into the consuming project. This leads to library names added "-d" in debug mode. Which is not always wanted.

If those lines are needed, I would like to suggest putting it behind a cmake option for those who don't want this. For example like

option(CELERO_SET_LIBRARY_POSTFIX "Set OFF to prevent celero setting cache variables for CMAKE_<BUILDTYPE>_POSTFIX." ON)

if(CELERO_SET_LIBRARY_POSTFIX)
	set(CMAKE_DEBUG_POSTFIX          "-d" CACHE STRING "add a postfix, usually d on windows")
	set(CMAKE_RELEASE_POSTFIX        "" CACHE STRING "add a postfix, usually empty on windows")
	set(CMAKE_RELWITHDEBINFO_POSTFIX "-rd" CACHE STRING "add a postfix, usually empty on windows")
	set(CMAKE_MINSIZEREL_POSTFIX     "" CACHE STRING "add a postfix, usually empty on windows")
endif()

ferkulat avatar Oct 06 '23 13:10 ferkulat