How to do it right way?
Creating a project with a custom makefile just leaves many things not working - compilation errors doesn't show, code completion doesn't work for included files not in default path (their pathes are found by cmake during the confiugration).
Really, why reinvent the wheel, when CMake exists? It's so flexible, and can be used with any IDE (theoretically).
It would be so great to have a native CMake support, out of the box.
Using CMake with CodeLite
- Mad Fish
- CodeLite Curious
- Posts: 4
- Joined: Sun Nov 22, 2009 12:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
You probably forgot to tell codelite how to build. Custom makefile means that YOU provide the makefileMad Fish wrote:Creating a project with a custom makefile just leaves many things not working
Not related. code completion has NOTHING to do with the way the project is setup. the CodeCompletion paths are different than the compiler ones (for various reasons which I will not list here) - to set up code completion include paths, you set them from the menu: 'Settings -> Tags Settings -> Include Files'Mad Fish wrote:code completion doesn't work for included files not in default path
Also, qmake, premake, configure and the list goes on and on...Mad Fish wrote:Really, why reinvent the wheel, when CMake exists?
Custom build does not re-invent anything. If you want to use CMake, use it - set the command to run for generating the makefile (you have a text field for it), and then specify the commands for the build (usually make for build and make clean for clean) - if you need help configuring it, ask here.
You can set up a project properly once, and then save it as templateMad Fish wrote:It would be so great to have a native CMake support, out of the box.
I can imagine why you want to use CMake - cause you are probably familar with it. IMO, if you dont need to, use codelite internal managed makefile rather than using CMake. I will choose to use 3rd party makefile generator tools (like qmake) in cases when I am working on an already running project which uses it, if I can avoid it and let codelite manage my makefiles - I will prefer to let codelite to do it.
Eran
Make sure you have read the HOW TO POST thread
- Mad Fish
- CodeLite Curious
- Posts: 4
- Joined: Sun Nov 22, 2009 12:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
It CAN build, but doesn't parse compilation errors.eranif wrote:You probably forgot to tell codelite how to build. Custom makefile means that YOU provide the makefile
Why there are only global paths for code completion? Why there is no project-specific ones?eranif wrote:Not related. code completion has NOTHING to do with the way the project is setup. the CodeCompletion paths are different than the compiler ones (for various reasons which I will not list here) - to set up code completion include paths, you set them from the menu: 'Settings -> Tags Settings -> Include Files'
I set the command for generating, but it seems CodeLite doesn't execute it on build - at least, no cmake output is visible in "Output"eranif wrote:Custom build does not re-invent anything. If you want to use CMake, use it - set the command to run for generating the makefile (you have a text field for it), and then specify the commands for the build (usually make for build and make clean for clean) - if you need help configuring it, ask here.
I want to use CMake because of automated dependency search. I just write find_package(...) and it's ready to use. It's so convenient. And also it allows to work in heterogeneous environment. For example, one developer is using Visual Studio, other one uses Eclipse, and the other uses CodeLite (or Code::Blocks, emacs, NetBeans, and so on).eranif wrote:I can imagine why you want to use CMake - cause you are probably familar with it. IMO, if you dont need to, use codelite internal managed makefile rather than using CMake. I will choose to use 3rd party makefile generator tools (like qmake) in cases when I am working on an already running project which uses it, if I can avoid it and let codelite manage my makefiles - I will prefer to let codelite to do it.
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
Lets start from start:
I will describe here, how to use qmake since I am most familiar with tool, you simply do s/qmake/cmake/ in the relevant placed
Assuming that I want to build my project with qmake generated makefiles, I will use qmake capability for generating gnu makefiles.
Now, what I want to achieve is the ability to run qmake (usually once) and then make.
To do this, I create a custom makefile project and then I do the following:
- right click the project and selects the 'custom build' tab (make sure it is enabled)
- in the 'makefile generators' I choose: Other
- in the 'Command to use for makefile generation' I place 'qmake'
- in the 'Working directory' I use the macro $(ProjectPath) (to see list of macros, click the 'Help...' button)
- I click OK and closes this dialog
See below the picture for how the dialog looks like.
Next, to build I first want to run qmake once to generate the makefile.
- right click the project and select 'Run Other' (I know, a better name could have been choosen here ) - the output of CMake is placed in the 'Output' Tab
- From this point on - I simply use the common build shortcuts to build (F7) - the output of the build is set to the 'Build' tab.
In case your generated makefile is using VC++ compiler (CL.EXE), make sure you selects the appropriate compiler so the output is parsed correctly - this is done in the project settings -> General Tab 'Compiler' choice control.
Hope this helps,
I will describe here, how to use qmake since I am most familiar with tool, you simply do s/qmake/cmake/ in the relevant placed
Assuming that I want to build my project with qmake generated makefiles, I will use qmake capability for generating gnu makefiles.
Now, what I want to achieve is the ability to run qmake (usually once) and then make.
To do this, I create a custom makefile project and then I do the following:
- right click the project and selects the 'custom build' tab (make sure it is enabled)
- in the 'makefile generators' I choose: Other
- in the 'Command to use for makefile generation' I place 'qmake'
- in the 'Working directory' I use the macro $(ProjectPath) (to see list of macros, click the 'Help...' button)
- I click OK and closes this dialog
See below the picture for how the dialog looks like.
Next, to build I first want to run qmake once to generate the makefile.
- right click the project and select 'Run Other' (I know, a better name could have been choosen here ) - the output of CMake is placed in the 'Output' Tab
- From this point on - I simply use the common build shortcuts to build (F7) - the output of the build is set to the 'Build' tab.
In case your generated makefile is using VC++ compiler (CL.EXE), make sure you selects the appropriate compiler so the output is parsed correctly - this is done in the project settings -> General Tab 'Compiler' choice control.
Hope this helps,
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
- Mad Fish
- CodeLite Curious
- Posts: 4
- Joined: Sun Nov 22, 2009 12:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
Well, when .workspace and .project are in the same directory as the root Makefile, error parsing is working. Otherwise - no.
And some other minor issues:
* In the project settings there is no "All configurations" option, like in Visual Studio
* In workspace view, I can't see location of files. It would be more convenient for CMake project just to use Explorer tab. It would be great to have a option to set a root path for Explorer, so unrelated files will not appear.
* For the small screen (I'm working from netbook right now, 1024x600) icons in toolbar are VERY big. And the option to make them smaller doesn't make smaller the toolbar itself, so it's really useless. And I can't change toolbar size by hand.
And really, why, why the codecompletion paths are different from compiler ones?
Anyway, thanks for great IDE. It is the closest to ideal at moment (from all Linux C/C++ IDEs).
And some other minor issues:
* In the project settings there is no "All configurations" option, like in Visual Studio
* In workspace view, I can't see location of files. It would be more convenient for CMake project just to use Explorer tab. It would be great to have a option to set a root path for Explorer, so unrelated files will not appear.
* For the small screen (I'm working from netbook right now, 1024x600) icons in toolbar are VERY big. And the option to make them smaller doesn't make smaller the toolbar itself, so it's really useless. And I can't change toolbar size by hand.
And really, why, why the codecompletion paths are different from compiler ones?
Anyway, thanks for great IDE. It is the closest to ideal at moment (from all Linux C/C++ IDEs).
-
- CodeLite Guru
- Posts: 351
- Joined: Mon Oct 20, 2008 7:26 pm
- Genuine User: Yes
- IDE Question: C++
- Location: France
- Contact:
Re: Using CMake with CodeLite
There a 'global settings' choice in project settings which allow you to define options for all configurations. Maybe it would have been better to call it 'All configurations'.Mad Fish wrote:* In the project settings there is no "All configurations" option, like in Visual Studio
If you import a directory, CL will create 'virtual directories', just like the filesystem one. You can create those virtual directory by hand, and add the file you want inside them.Mad Fish wrote:* In workspace view, I can't see location of files.
You can define the path needed for code completion as you want in settings -> tag settings which allow you to add more available completion than just the compiler one.Mad Fish wrote:And really, why, why the codecompletion paths are different from compiler ones?
Jérémie
- eranif
- CodeLite Plugin
- Posts: 6375
- Joined: Wed Feb 06, 2008 9:29 pm
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
Its a known bug with a simple solution:Mad Fish wrote:* For the small screen (I'm working from netbook right now, 1024x600) icons in toolbar are VERY big. And the option to make them smaller doesn't make smaller the toolbar itself, so it's really useless. And I can't change toolbar size by hand.
- change the toolbar size to 16x16
- close codelite
- delete the file C:\Program Files\Codelite\config\codelite.layout
- restart codelite
Searching 'toolbar icons' in the forum gave me this:
http://codelite.org/forum/viewtopic.php ... cons#p2821
Eran
Make sure you have read the HOW TO POST thread
- Mad Fish
- CodeLite Curious
- Posts: 4
- Joined: Sun Nov 22, 2009 12:32 am
- Genuine User: Yes
- IDE Question: C++
- Contact:
Re: Using CMake with CodeLite
Just have noticed this:
http://www.cmake.org/Bug/view.php?id=9901
Really waiting for positive results there. Better integration will be great.
http://www.cmake.org/Bug/view.php?id=9901
Really waiting for positive results there. Better integration will be great.