Create a codeblocks project on Linux using CMake

Source: Internet
Author: User

Recently on the use of Linux CMake, for the use of GUI habits really can not adapt, really want to do everything possible to use the original CMake project created Codeblocks project. The project is too small to accept, the project is too much trouble.

Look at the official documents of CMake from 2.2.8 later versions can be directly used to generate the Codeblocks project, my little heart ah ... But the relevant article is not too much, may have I this idea is not too much, general use CMake is a master, will not be so daoteng, nonsense said, the following directly from the simplest project to start it.

Because CMake official recommends using external compilation, we'd better use external compilation as well. Create a new folder for T1, under which a new two directory is HELLO_SRC, build. HELLO_SRC store source files and Cmakelists.txt,build to store generated codeblocks works.

  

The MAIN.C code is

1 #include <stdio.h>2int  main ()3{4     printf ("Hello World from T1 main!\n"); 5     return 0 ; 6 }

CMakeLists.txt

1 PROJECT (HELLO) 2 SET (src_list main.c) 3 "  "  ${hello_binary_dir})4""${hello_ Source_dir})5 add_executable (Hello  ${src_list})

CMake. /hello_src-g "Codeblocks-unix makefiles"

Enter the build and see the Codeblocks project.

But the direct compile run is problematic,

Select project-"properties-" Build targets

Revision changed to

Then click Compile to run successfully:

Create a codeblocks project on Linux using CMake

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.