Page 1 of 1

difference between Project Settings and CMakeLists.txt?

Posted: Tue Jun 09, 2020 6:22 pm
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?

Re: difference between Project Settings and CMakeLists.txt?

Posted: Tue Jun 16, 2020 7:07 pm
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?

Re: difference between Project Settings and CMakeLists.txt?

Posted: Tue Jun 16, 2020 8:23 pm
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

Re: difference between Project Settings and CMakeLists.txt?

Posted: Wed Jun 17, 2020 12:02 am
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

Re: difference between Project Settings and CMakeLists.txt?

Posted: Wed Jun 17, 2020 3:35 pm
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...

Re: difference between Project Settings and CMakeLists.txt?

Posted: Mon Jun 29, 2020 12:30 pm
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)