Fix CMAKE_BUILD_TYPE default on Windows for dependencies

This commit is contained in:
Duncan Ogilvie
2025-11-23 21:03:00 -05:00
committed by Kyle Elliott
parent f8acc718c9
commit 2302aa8c8a
2 changed files with 9 additions and 6 deletions
+8 -2
View File
@@ -1,7 +1,13 @@
# https://alexreinking.com/blog/how-to-use-cmake-without-the-agonizing-pain-part-1.html
cmake_minimum_required(VERSION 3.21)
project(cxx-common)
# Default to a Release config. Required before project() because Windows defaults to Debug
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
project(dependencies)
option(USE_EXTERNAL_LLVM "Do not compile LLVM as part of the superbuild, use an external one instead" OFF)
option(USE_SANITIZERS "Use ASan and UBSan" OFF)
@@ -18,7 +24,7 @@ if(USE_EXTERNAL_LLVM)
set(CMAKE_PREFIX_PATH "${BREW_LLVM_PREFIX}")
message(STATUS "Found LLVM keg installed by Homebrew at ${BREW_LLVM_PREFIX}")
else()
message(FATAL_ERROR "LLVM not found, to install: brew install llvm")
message(WARNING "LLVM not found, to install: brew install llvm")
endif()
endif()
find_package(LLVM CONFIG REQUIRED)
+1 -4
View File
@@ -11,12 +11,9 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "In-tree builds are not supported. Run CMake from a separate directory: cmake -B build")
endif()
# Default to a Release config
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "")
if(CMAKE_BUILD_TYPE STREQUAL "")
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
message(FATAL_ERROR "CMAKE_BUILD_TYPE is not set")
endif()
message(STATUS "Configuration: ${CMAKE_BUILD_TYPE}")
# Default to build/install (setting this variable is not recommended and might cause conflicts)