Skip to content

Commit

Permalink
Fixes issues where CMakeCache.txt does not contain CMAKE_BUILD_TYPE
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias-Fischer authored Jan 8, 2025
1 parent 9265549 commit 60969d1
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions recipe/patches/0016-use-environment-build-type.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/tools/setup_helpers/env.py b/tools/setup_helpers/env.py
index 6332a66e7be06a..208b504a65afc3 100644
--- a/tools/setup_helpers/env.py
+++ b/tools/setup_helpers/env.py
@@ -63,19 +63,6 @@ class BuildType:
def __init__(self, cmake_build_type_env: str | None = None) -> None:
if cmake_build_type_env is not None:
self.build_type_string = cmake_build_type_env
- return
-
- cmake_cache_txt = os.path.join(BUILD_DIR, "CMakeCache.txt")
- if os.path.isfile(cmake_cache_txt):
- # Found CMakeCache.txt. Use the build type specified in it.
- from .cmake_utils import get_cmake_cache_variables_from_file
-
- with open(cmake_cache_txt) as f:
- cmake_cache_vars = get_cmake_cache_variables_from_file(f)
- # Normally it is anti-pattern to determine build type from CMAKE_BUILD_TYPE because it is not used for
- # multi-configuration build tools, such as Visual Studio and XCode. But since we always communicate with
- # CMake using CMAKE_BUILD_TYPE from our Python scripts, this is OK here.
- self.build_type_string = cast(str, cmake_cache_vars["CMAKE_BUILD_TYPE"])
else:
self.build_type_string = os.environ.get("CMAKE_BUILD_TYPE", "Release")

0 comments on commit 60969d1

Please sign in to comment.