[cmake-developers] Compiling with a programmatic way

Micha Hergarden micha.hergarden at gmail.com
Sun Dec 14 04:22:06 EST 2014


Hello Djou,

You will be better of asking this question on the 'cmake' mailing list
itself. That is geared towards cmake users. This list is for people
developing cmake itself.

Here is a cmake example to get you started:

project(DEMO)
cmake_minimum_required(VERSION 2.8)

add_executable(demo main.cxx)

If you save this to a file called CMakeLists.txt and create a build
directory, you can call 'cmake <sourcedirectory>'  (fill in the actual
source directory) and cmake will generate a buildsystem for you (i.e. a
Makefile or a visual studio project file). Then you just call 'make' in
the case of a Makefile and your executable will be compiled for you.

HTH,
Micha

On 12/12/2014 10:24 PM, djou akr wrote:
> To whom it may concern
>
> I am trying to find how to compile in an automatic ( programmatically
> ) way a c++ file without the manual way in the terminal (I am on ubuntu)
>
> I mean, while a c++ file is executing it will compile another c++ file
> at run time. Of course this with the use of make and cmake.
>
> Thanks in advance
> Best regards
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141214/a93c2ed7/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL: <http://public.kitware.com/pipermail/cmake-developers/attachments/20141214/a93c2ed7/attachment.sig>


More information about the cmake-developers mailing list