Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Windows][CMake] Debug and Release versions at same time. #347

Open
tarhan opened this issue Aug 8, 2020 · 1 comment
Open

[Windows][CMake] Debug and Release versions at same time. #347

tarhan opened this issue Aug 8, 2020 · 1 comment

Comments

@tarhan
Copy link
Contributor

tarhan commented Aug 8, 2020

For CMake case
I'm not sure how you using your library on developers PCs. But it is very inconvenient that install library file path are same for debug and release configurations.
When using MSVC toolchains using Visual Studio or Ninja Multi-Config compiled library bonded to either Visual C++ Release or Debug DLLs. So to use library I have to use different CMAKE_INSTALL_PREFIX for your library and then use its different paths for debug and release configurations. It is not very convenient for non expert developers.

I think that you should use different library name suffix for debug version of installed library as commonly used in popular libraries like Qt, OpenCV, VTK and etc.
In you install rules section in CMakeLists.txt you should add following lines:

if(WIN32)
    set_target_properties(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX d)
endif()

So there will be two libraries:

amqpcpp.lib
amqpcppd.lib

Clients of libraries can use single install path of library within their IDEs. For example settings.json in Visual Studio Code could contains following configuration:

{
    "cmake.configureEnvironment": {
        "Qt5_DIR": "C:/Qt/5.15.0/msvc2019_64",
        "amqpcpp_DIR": "c:/LIBS/install_AMQPCPP/cmake"
    }
}

Then developer could easily switch between debug and release configurations without worrying about Visual C++ DLLs versions.
VS 2019 have GUI editor for specifying CMake paths same as Qt Creator.

@Maturin
Copy link

Maturin commented May 27, 2022

This did the trick for me:

cmake -G "Ninja Multi-Config" -DCMAKE_DEBUG_POSTFIX=d ..
ninja -f build-Debug.ninja
ninja -f build-Release.ninja

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants