Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Sublime Text with cmake (build system)

I am using Sublime Text in Ubuntu and learning OpenCV. Until today, I was using Sublime Text to write and save the code, and using Terminal for compiling.

I am compiling with the following code:

cmake .
make
./a.out

But for fast processing, I am trying to make my build system and I want to make this all automatically by pressing Ctrl + B

I've tried the following code in a custom build system but it fails:

{
    "cmd": ["cmake ."],
    "cmd": ["make"],
    "cmd": ["./a.o"],
    "selector": "source.c++",
    "shell": true,

    "windows":
    {
        "cmd": ["cl", "/Fo${file_path}", "/O2", "$file"],
        "selector": "source.c++",
        "shell": true
    }
}

Any ideas? Thanks.

like image 259
afedersin Avatar asked Dec 15 '22 07:12

afedersin


1 Answers

You should only have one "cmd" key in your build system. Please read the docs for more information. Instead, you can concatenate your commands using the && operator:

{
    "cmd": ["cmake .", "&&", "make", "&&", "./a.out"],
    "selector": "source.c++",
    "shell": true,
}

Since you're on Linux, you don't need the Windows stuff at all.

like image 190
MattDMo Avatar answered Dec 26 '22 06:12

MattDMo