4

I'm using:

  • sublime text 3
  • cmake
  • make on Mac and mingw-make on windows

So far I'm able to compile and run hello world using cmake and make. I'd like to be able to compile, link and run from within sublime text. By default, I didn't find a build system which allows me to do this.

Also, I understand that sublime text is just an editor but it also provides the notion of a build system where one can plugin your own.

If I run:

cmake .. -G "Sublime Text 2 - MinGW Makefiles"

It generates sublime text project file. When I open this project file in sublime, it populates build system with options from the generated make file (using cmake). It builds the executable but none of the build options allows me to run it.

Can someone help me understand how can I make the sublime run the project executable ?

Please let me know if I need to add more details here.

My directory structure is like this:

  • root
    • include
      • linkedlist.h
    • src
      • linkedlist.cpp
    • CMakeLists.txt
    • main.cpp

My CMakeLists.txt :

cmake_minimum_required(VERSION 2.8.9)
project(dataStructures)

#Bring the headers, into the project
include_directories(include)

#Can manually add the sources using the set command as follows:
set(MAINEXEC main.cpp)

#However, the file(GLOB...) allows for wildcard additions:
file(GLOB SOURCES "src/*.cpp")

add_executable(testDS ${SOURCES} ${MAINEXEC})
brainydexter
  • 19,826
  • 28
  • 77
  • 115

0 Answers0