From c4673d59e266c9659c111fd08f40ce9674ebb5e3 Mon Sep 17 00:00:00 2001 From: Duncan Ogilvie Date: Mon, 3 May 2021 16:52:39 +0200 Subject: [PATCH] Simplify default conditions It was JustMagic's idea to add 'lunix' --- src/cmkrlib/cmake.cpp | 9 +++++---- tests/conditions/cmake.toml | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/cmkrlib/cmake.cpp b/src/cmkrlib/cmake.cpp index 51c1468..9a2c2e1 100644 --- a/src/cmkrlib/cmake.cpp +++ b/src/cmkrlib/cmake.cpp @@ -259,10 +259,11 @@ CMake::CMake(const std::string &path, bool build) { } // Reasonable default conditions (you can override these if you desire) - conditions["win32"] = conditions["windows"] = conditions["win"] = "WIN32"; - conditions["macos"] = conditions["macosx"] = conditions["osx"] = conditions["mac"] = R"cond("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")cond"; - conditions["unix"] = "UNIX"; - conditions["linux"] = R"cond("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")cond"; + conditions["windows"] = R"cmake(WIN32)cmake"; + conditions["macos"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")cmake"; + conditions["unix"] = R"cmake(UNIX)cmake"; + conditions["bsd"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "BSD")cmake"; + conditions["linux"] = conditions["lunix"] = R"cmake("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")cmake"; if (toml.contains("conditions")) { auto conds = toml::find(toml, "conditions"); diff --git a/tests/conditions/cmake.toml b/tests/conditions/cmake.toml index 875aa31..ceed98b 100644 --- a/tests/conditions/cmake.toml +++ b/tests/conditions/cmake.toml @@ -8,10 +8,10 @@ custom = "CUSTOM" [target.example] type = "executable" sources = ["src/main.cpp"] -win32.sources = ["src/win32.cpp"] +windows.sources = ["src/windows_specific.cpp"] cmake-after = "message(STATUS cmake-after)" -win32.cmake-after = "message(STATUS win32-after)" -unix.cmake-after = "message(STATUS unix-after)" +windows.cmake-after = "message(STATUS win32-after)" macos.cmake-after = "message(STATUS macos-after)" -custom.cmake-after = "message(STATUS custom-after)" -linux.cmake-after = "message(STATUS linux-after)" \ No newline at end of file +linux.cmake-after = "message(STATUS linux-after)" +unix.cmake-after = "message(STATUS unix-after)" +custom.cmake-after = "message(STATUS custom-after)" \ No newline at end of file