How to use Cmake in Codelite

General questions regarding the usage of CodeLite
Fox Mulder
CodeLite Enthusiast
Posts: 38
Joined: Wed Oct 03, 2012 12:19 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to use Cmake in Codelite

Post by Fox Mulder »

I finally got some Output from Codelite by building with cmake. But now Im completely confused.
Where is my Target directory which I specified under Project Settings->Cmake (Build directory: $(ProjectPath)\Build)
Now I got the cmakeFiles directory and then 3.0.0rc and cmakeTemp (see attachment).
And now I cant start the debugger cause I get the error:
No executable specified use "target" exec.
You do not have the required permissions to view the files attached to this post.
I want to believe.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to use Cmake in Codelite

Post by eranif »

You should separate the build files from the source files.
I suggest that you first try to build something _without_ codelite but with cmake and then try to integrate the two.

For example, create an hello world application.

Create an empty folder with 2 files:

main.cpp:

Code: Select all

#include <iostream>
int main(int argc, char **argv)
{
    std::cout << "hello world" << std::endl;
    return 0;
}
and second file, CMakeLists.txt

Code: Select all

cmake_minimum_required(VERSION 2.8)

set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" )
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" )
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib" )

## Use the variable PROJECT_NAME for changing the target name
set( PROJECT_NAME "HelloWorld" )

## Set our project name
project(${PROJECT_NAME})

## Use all the *.cpp files we found under this folder for the project
FILE(GLOB SRCS "*.cpp" "*.c")

## Define the executable
add_executable(${PROJECT_NAME} ${SRCS})
To build it, open CMD.EXE and CD to the folder you have placed the files:

Code: Select all

mkdir build-debug
cd build-debug
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug
mingw32-make
Thats it.
You should now have the file:
build-debug/bin/HelloWorld.exe

Play with it, learn about CMake and then try to integrate it into codelite

Eran
Make sure you have read the HOW TO POST thread
Fox Mulder
CodeLite Enthusiast
Posts: 38
Joined: Wed Oct 03, 2012 12:19 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: How to use Cmake in Codelite

Post by Fox Mulder »

Yep you probably right here, im not ready for cmake and should learn it first. Anyway I wish there would be a tutorial with features which are integrated and some explanation for it, I know its time consuming but so helpful. Its not just this plugin, lots of setting options are not explained and even there is a Help button in every dialog window, it contains nothing useful. I wish you would clean this up a little bit after the 6.0 Release, a good documentation is the most attractive feature for the most people.
Anyway, thanks for your time Eran.
I want to believe.
Post Reply