Skip to content

CXX-2726 do not override CMAKE_BUILD_TYPE for multi-config generator #1006

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

Merged
merged 3 commits into from
Aug 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ if(BUILD_VERSION STREQUAL "0.0.0")
endif()
endif()

if(NOT CMAKE_BUILD_TYPE)
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

if(NOT CMAKE_BUILD_TYPE AND NOT isMultiConfig)
# Do not override CMAKE_BUILD_TYPE if generator is multi config. CMAKE_BUILD_TYPE is ignored for multi-config generators.
message(STATUS "No build type selected, default is Release")
set(CMAKE_BUILD_TYPE "Release")
endif()
Expand Down
7 changes: 3 additions & 4 deletions docs/content/mongocxx-v3/installation/windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,19 +145,18 @@ directory by using the `-DLIBMONGOC_DIR` and `-DLIBBSON_DIR` options:

```sh
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DLIBMONGOC_DIR=C:\mongo-c-driver \
-DLIBBSON_DIR=C:\mongo-c-driver \
-DCMAKE_INSTALL_PREFIX=C:\mongo-cxx-driver
```

### Step 5: Build and install the driver

Build and install the driver:
Build and install the driver. Use `--config` to select a build configuration (e.g. `Debug`, `RelWithDebInfo`, `Release`):

```sh
cmake --build .
cmake --build . --target install
cmake --build . --config RelWithDebInfo
cmake --build . --target install --config RelWithDebInfo
```

The driver can be uninstalled at a later time in one of two ways. First,
Expand Down