Name debug libraries with "d" postfix on Windows
Posted: Tue Oct 15 2024 11:27 am
I build and install CopperSpice on Windows like this:
> cmake --build . --config Release
> cmake --install . --config Release
> cmake --build . --config Debug
> cmake --install . --config Debug
When I then build my own project, cmake should link against the correct library depending on whether my build configuration is release or debug. But it appears that CopperSpice does not add the "d" on debug library names. This results in the Release build being overwritten by the Debug build when the Debug build is installed.
Adding the following line to Windows-specific code in the top-level CMakeLists.txt file results in library names that follow the "d" convention:
SET(CMAKE_DEBUG_POSTFIX d)
> cmake --build . --config Release
> cmake --install . --config Release
> cmake --build . --config Debug
> cmake --install . --config Debug
When I then build my own project, cmake should link against the correct library depending on whether my build configuration is release or debug. But it appears that CopperSpice does not add the "d" on debug library names. This results in the Release build being overwritten by the Debug build when the Debug build is installed.
Adding the following line to Windows-specific code in the top-level CMakeLists.txt file results in library names that follow the "d" convention:
SET(CMAKE_DEBUG_POSTFIX d)