DigitalInBlue / Celero

C++ Benchmark Authoring Library/Framework
Other
822 stars 96 forks source link

CMAKE_<BUILD_TYPE>_POSTFIX spills into consuming project #171

Open ferkulat opened 11 months ago

ferkulat commented 11 months ago

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 commented 11 months ago

I see v2.9.0 might contain breaking changes. That's why I would like to see this fix in a v2.8.X version. Shall I make a pull request to branch "develop" instead?