difference between Project Settings and CMakeLists.txt?

General questions regarding the usage of CodeLite
amwink
CodeLite Enthusiast
Posts: 27
Joined: Mon Jun 08, 2020 4:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

difference between Project Settings and CMakeLists.txt?

Post by amwink »

I am trying to build a project that includes a library from a directory (CImg) in the project's parent directory (it is used by many other projects).

When I compile my project from the command line I can do
-I../../
(from src) and then in the code
#include "CImg/Cimg.h"
works.

After I put the directories in order and made a project, I set the compiler directories by doing
<right-click on the project>
<Settings>
<Compiler>
<Include Paths>
and add ".." (and later also "../.."

However that does not seem to work, because although it shows up in the menu the compiler says:
fatal error: CImg/CImg.h: no such file or directory.

When I do
<right-click on the project>
<Open CMakelists.txt>
and add
include_directories(
.
..
)

then the compilation works. BUT: the value of <Settings><Compiler><Include Paths> is not changed!

One of the attractions of CodeLite to me is that it has CMake project files. But that would mean that if you change the project settings, it would
  • also change in the CMakelists.txt file
  • incorporate this in the build immediately?
Is that assumption correct or is <Settings><Compiler><Include Paths> not for setting project-wide include variables?
amwink
CodeLite Enthusiast
Posts: 27
Joined: Mon Jun 08, 2020 4:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: difference between Project Settings and CMakeLists.txt?

Post by amwink »

I just realised that I had set the build system as Cmake.

Would that mean that the Project Settings are ignored and only Cmakelists.txt information is used?
(perhaps) Naively I assumed that they would be interchangeable...

Does the setting Codelite Make Generator or Default respond to changes in Project Settings?
DavidGH
CodeLite Plugin
Posts: 819
Joined: Wed Sep 03, 2008 7:26 pm
Contact:

Re: difference between Project Settings and CMakeLists.txt?

Post by DavidGH »

Hi,
Would that mean that the Project Settings are ignored and only Cmakelists.txt information is used?
I've not tried a CodeLite cmake project but I wouldn't be surprised if that's true, even if it's unintentional. Cmake projects are a fairly recent addition so they're quite likely to be imperfect.

Why not try a standard 'Default' project, or the (also recent but better tested) File System workspace?

Regards,

David
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: difference between Project Settings and CMakeLists.txt?

Post by eranif »

When using CMake build, CodeLite will translate the settings into CMake code
So you don't need to update the CMakeLists.txt by hand, but you edit the project settings and CodeLite will translate it for you to Cmake
Make sure you have read the HOW TO POST thread
amwink
CodeLite Enthusiast
Posts: 27
Joined: Mon Jun 08, 2020 4:04 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: difference between Project Settings and CMakeLists.txt?

Post by amwink »

So you don't need to update the CMakeLists.txt by hand, but you edit the project settings and CodeLite will translate it for you to Cmake
That's what I expected -- but then I don't understand why adding directory '..' for including a library from up the directory tree does not build in Project Settings and does work when I put it manually in Cmakelists.txt?

But I have used a combination -- Files System Based Workspace and Cmakelists.txt Based Project -- that apparently does not work because the former builds the dependencies on paths alone? Will start from scratch, I was not aware that file system-based workspaces were completely directory-based only...
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: difference between Project Settings and CMakeLists.txt?

Post by eranif »

The auto generated CMakeLists is working only when you with the default C++ workspace.
If you pick the 'File System' one, well, it's just a a directory tree (as you figured it out)
Make sure you have read the HOW TO POST thread
Post Reply