From 6c1e38839193cda12ea1fcdd39c694cbdf3d93a1 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Thu, 30 Dec 2021 14:27:07 +0100 Subject: [PATCH] Add root, x64 and x32 conditions --- docs/cmake-toml.md | 3 +++ src/project_parser.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/docs/cmake-toml.md b/docs/cmake-toml.md index d00522b..e81b9a7 100644 --- a/docs/cmake-toml.md +++ b/docs/cmake-toml.md @@ -70,6 +70,9 @@ linux = "CMAKE_SYSTEM_NAME MATCHES \"Linux\"" gcc = "CMAKE_CXX_COMPILER_ID STREQUAL \"GNU\" OR CMAKE_C_COMPILER_ID STREQUAL \"GNU\"" clang = "CMAKE_CXX_COMPILER_ID MATCHES \"Clang\" OR CMAKE_C_COMPILER_ID MATCHES \"Clang\"" msvc = "MSVC" +root = "CMKR_ROOT_PROJECT" +x64 = "CMAKE_SIZEOF_VOID_P EQUAL 8" +x32 = "CMAKE_SIZEOF_VOID_P EQUAL 4" ``` ## Subdirectories diff --git a/src/project_parser.cpp b/src/project_parser.cpp index 9e71b2f..0a693b2 100644 --- a/src/project_parser.cpp +++ b/src/project_parser.cpp @@ -236,6 +236,9 @@ Project::Project(const Project *parent, const std::string &path, bool build) { conditions["gcc"] = R"cmake(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")cmake"; conditions["clang"] = R"cmake(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang")cmake"; conditions["msvc"] = R"cmake(MSVC)cmake"; + conditions["root"] = R"cmake(CMKR_ROOT_PROJECT)cmake"; + conditions["x64"] = R"cmake(CMAKE_SIZEOF_VOID_P EQUAL 8)cmake"; + conditions["x32"] = R"cmake(CMAKE_SIZEOF_VOID_P EQUAL 4)cmake"; } else { conditions = parent->conditions; }