cd /news/developer-tools/llvm-22-macports-cmake-setup · home topics developer-tools article
[ARTICLE · art-9428] src=gist.github.com ↗ pub= topic=developer-tools verified=true sentiment=· neutral

LLVM 22 MacPorts CMake setup

The article provides a CMake setup configuration for LLVM 22 on macOS using MacPorts, including a `toolchain.cmake` file that specifies the LLVM 22 compiler path, C++23 standard, and required include/link directories. It also includes `launch.json` and `tasks.json` configurations for debugging and building projects with LLDB and CMake tasks in VS Code.

read2 min views20 publishedMay 22, 2026

launch.json

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
{

    "version": "0.2.0",

    "configurations": [

        {

            "name": "Run",

            "type": "lldb",

            "request": "launch",

            "program": "build/<progname>",

            "args": [],

            "cwd": "${workspaceFolder}",

        },

        {

            "name": "<progname> compile+run",

            "type": "lldb",

            "request": "launch",

            "program": "${workspaceFolder}/build/<progname>",

            "args": [],

            "cwd": "${workspaceFolder}",

            "preLaunchTask": "cmake",

        },

    ]

}

Makefile

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
cmake-configure:

	rm -rf build && cmake --toolchain toolchain.cmake -S . -B build

cmake-build:

	cmake --build build -v

tasks.json

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
{

    "tasks": [

        {

            "label": "cmake-configure",

            "type": "shell",

            "command": "make",

            "args": [

                "cmake-configure",

            ],

            "presentation": {

                "close": true,

                "reveal": "never",

                "showReuseMessage": false,

                "echo": false,

            },

        },

        {

            "label": "cmake-build",

            "type": "shell",

            "command": "make",

            "args": [

                "cmake-build",

            ],

            "presentation": {

                "close": true,

                "reveal": "never",

                "showReuseMessage": false,

                "echo": false,

            },

        },

        {

            "label": "cmake",

            "type": "shell",

            "dependsOn": [

                "cmake-configure",

                "cmake-build",

            ],

            "dependsOrder": "sequence",

            "presentation": {

                "close": true,

                "reveal": "never",

                "showReuseMessage": false,

                "echo": false,

            },

        }

    ],

    "version": "2.0.0"

}

toolchain.cmake

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters

set(CMAKE_CXX_COMPILER /opt/local/libexec/llvm-22/bin/clang++)

set(CMAKE_CXX_STANDARD 23)

set(CMAKE_CXX_STANDARD_REQUIRED On)

set(CMAKE_CXX_EXTENSIONS Off)

set(CMAKE_OSX_DEPLOYMENT_TARGET 13.3)

set(CMAKE_EXPORT_COMPILE_COMMANDS On)

add_compile_options(

    -stdlib=libc++

    -nostdinc++

    "-isystem/usr/local/include"

    "-isystem/opt/local/libexec/llvm-22/include/c++/v1"

    "-isystem/opt/local/libexec/llvm-22/lib/clang/22/include"

)

add_link_options(

    -stdlib=libc++

    "-Wl,-rpath,/opt/local/libexec/llvm-22/lib/libc++"

    "-Wl,-rpath,/opt/local/libexec/llvm-22/lib/libunwind"

    "-L/opt/local/libexec/llvm-22/lib/libc++"

    "-L/opt/local/libexec/llvm-22/lib/libunwind"

)
── more in #developer-tools 4 stories · sorted by recency
── more on @llvm 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/llvm-22-macports-cma…] indexed:0 read:2min 2026-05-22 ·