friendlyanon / cmake-init

The missing CMake project initializer
GNU General Public License v3.0
1.98k stars 75 forks source link

ERROR: uninitialized variable 'CMAKE_CONFIGURATION_TYPES' #104

Closed ClausKlein closed 6 months ago

ClausKlein commented 6 months ago

The cmake-init v0.37.1 generated Presets are not usable:

Run cmake "--preset=ci-$("ubuntu-22.04".split("-")[0])" -D BUILD_SHARED_LIBS=YES
Preset CMake variables:

  CMAKE_BUILD_TYPE="Release"
  CMAKE_CXX_CLANG_TIDY="clang-tidy;--header-filter=^/home/runner/work/cmake-init-modules/cmake-init-modules/"
CMake Error (dev) at conan/conan_toolchain.cmake:44 (foreach):
  uninitialized variable 'CMAKE_CONFIGURATION_TYPES'
Call Stack (most recent call first):
  /usr/local/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:170 (include)
  CMakeLists.txt:5 (project)
This error is for project developers. Use -Wno-error=dev to suppress it.

Possible solution:

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index efedcfa..0e7fc72 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -146,19 +163,54 @@
     {
       "name": "ci-build",
       "binaryDir": "${sourceDir}/build",
-      "hidden": true
+      "hidden": true,
+      "cacheVariables": {
+        "CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Release;Debug;"
+      }
     },
     {
       "name": "ci-macos",
friendlyanon commented 6 months ago

This is a regression in Conan 2.1 and it seems to be slated for release in 2.2: https://github.com/conan-io/conan/issues/15735