Skip to content

Commit 2302aa8

Browse files
mrexodiakyle-elliott-tob
authored andcommitted
Fix CMAKE_BUILD_TYPE default on Windows for dependencies
1 parent f8acc71 commit 2302aa8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

dependencies/CMakeLists.txt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
# https://alexreinking.com/blog/how-to-use-cmake-without-the-agonizing-pain-part-1.html
22
cmake_minimum_required(VERSION 3.21)
33

4-
project(cxx-common)
4+
# Default to a Release config. Required before project() because Windows defaults to Debug
5+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
6+
if(CMAKE_BUILD_TYPE STREQUAL "")
7+
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
8+
endif()
9+
10+
project(dependencies)
511

612
option(USE_EXTERNAL_LLVM "Do not compile LLVM as part of the superbuild, use an external one instead" OFF)
713
option(USE_SANITIZERS "Use ASan and UBSan" OFF)
@@ -18,7 +24,7 @@ if(USE_EXTERNAL_LLVM)
1824
set(CMAKE_PREFIX_PATH "${BREW_LLVM_PREFIX}")
1925
message(STATUS "Found LLVM keg installed by Homebrew at ${BREW_LLVM_PREFIX}")
2026
else()
21-
message(FATAL_ERROR "LLVM not found, to install: brew install llvm")
27+
message(WARNING "LLVM not found, to install: brew install llvm")
2228
endif()
2329
endif()
2430
find_package(LLVM CONFIG REQUIRED)

dependencies/superbuild.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
1111
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
1212
endif()
1313

14-
# Default to a Release config
15-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
1614
if(CMAKE_BUILD_TYPE STREQUAL "")
17-
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
15+
message(FATAL_ERROR "CMAKE_BUILD_TYPE is not set")
1816
endif()
19-
2017
message(STATUS "Configuration: ${CMAKE_BUILD_TYPE}")
2118

2219
# Default to build/install (setting this variable is not recommended and might cause conflicts)

0 commit comments

Comments
 (0)