Skip to content

Commit 25da317

Browse files
committed
Add default conditions for gcc/clang/msvc
1 parent 9590760 commit 25da317

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/project_parser.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -314,10 +314,13 @@ Project::Project(const std::string &path, bool build) {
314314

315315
// Reasonable default conditions (you can override these if you desire)
316316
conditions["windows"] = R"cmake(WIN32)cmake";
317-
conditions["macos"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")cmake";
317+
conditions["macos"] = R"cmake(CMAKE_SYSTEM_NAME MATCHES "Darwin")cmake";
318318
conditions["unix"] = R"cmake(UNIX)cmake";
319-
conditions["bsd"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")cmake";
320-
conditions["linux"] = conditions["lunix"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")cmake";
319+
conditions["bsd"] = R"cmake(CMAKE_SYSTEM_NAME MATCHES "BSD")cmake";
320+
conditions["linux"] = conditions["lunix"] = R"cmake(CMAKE_SYSTEM_NAME MATCHES "Linux")cmake";
321+
conditions["gcc"] = R"cmake(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "GNU")cmake";
322+
conditions["clang"] = R"cmake(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_C_COMPILER_ID MATCHES "Clang")cmake";
323+
conditions["msvc"] = R"cmake(MSVC)cmake";
321324

322325
if (toml.contains("conditions")) {
323326
auto conds = toml::find<decltype(conditions)>(toml, "conditions");

0 commit comments

Comments
 (0)