Using CMake and C++11 With Eclipse

Adam posted @ Sun, 02 Mar 2014 17:09:07 +0800 in C++ with tags cmake c++ eclipse , 2810 readers

Eclipse is a Good IDE for C++.

And, CMake is a useful Makefile generation tool.

We hope that we might integrate them together.

1 Quick Start with Old Projects

mkdir buildeclipse
cd buildeclipse/
cmake ../SOURCE_FILES/ -G"Eclipse CDT4 - Unix Makefiles"\
    -DCMAKE_ECLIPSE_VERSION=4.3\
    -DCMAKE_CXX_COMPILER_ARG1=-std=c++11

Note:

If you get an error of like this:

Could not determine Eclipse version, assuming at least 3.6 (Helios). Adjust CMAKE_ECLIPSE_VERSION if this is wrong.

use -D_ECLIPSE_VERSION=4.3 instead of -DCMAKE_ECLIPSE_VERSION=4.3.

2 A Project Example

PROJECT(HELLO)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

# Optional
# or SET(_ECLIPSE_VERSION 4.3). If you add these, you may omit `-DCMAKE_ECLIPSE_VERSION=4.3`
SET(CMAKE_ECLIPSE_VERSION 4.3)

ADD_EXECUTABLE(main main.cpp)
TARGET_LINK_LIBRARIES(main pthread)

Refs:

CDT/User/FAQ

CMake:Eclipse UNIX Tutorial

stackoverflow

lonksin said:
Tue, 19 Jun 2018 17:42:20 +0800

This programmer has been at the forefront of the activities for the individuals. The quantum of the programming and [url=https://www.superiorpaperrs.com/]https://www.superiorpaperrs.com/[/url] is in true sense for the use of the advantages for the humans. The formation is built for the productivity for all candidates for the programmers ND their affairs in life.

DwaynePatrick said:
Tue, 10 Jul 2018 02:45:14 +0800

Wow what a helpful post, working for one of the <a href="http://www.researchwritingkings.com/review-edubirdie-com/">edubirdie com</a>, I will definitely reference your blog for any aritcles or essays regarding programming and similar topics.


Login *


loading captcha image...
(type the code from the image)
or Ctrl+Enter