raysan5 / raylib-game-template

A small template to start your raylib game
zlib License
391 stars 92 forks source link

Why do you have 2 CMakeLists.txt? #30

Open sakunix opened 4 months ago

sakunix commented 4 months ago

Hi, why do you have 2 CMakeLists.txt? Doesn't this cause a conflict when creating the project?

I would like the template to be more neutral, so that it can be used in any IDE or text editor, such as Kdevelop, Gnome builder, kate, Eclipse, VIM, geditor, and not just in visual studio.

saludos.

sakunix commented 4 months ago

On the main page it says that it doesn't use external libraries, that only raylib is enough, but when loading the template it is asking me for external libraries.

imagen

kdevelop

russell-knight commented 3 months ago

Hi, why do you have 2 CMakeLists.txt? Doesn't this cause a conflict when creating the project?

I would like the template to be more neutral, so that it can be used in any IDE or text editor, such as Kdevelop, Gnome builder, kate, Eclipse, VIM, geditor, and not just in visual studio.

saludos.

The presence of multiple CMakeLists.txt files in a project is actually common practice and does not cause any conflicts. It helps structure the project into logical components, each containing it's own CMakeLists.txt file.

In this project's case the root CMakeLists.txt file is the entry point for CMake. You'll notice within this file there is a add_subdirectory(src) command. When this command is hit, CMake will:

  1. Change into the given directory (relative to the current directory).
  2. Process the CMakeLists.txt file in that directory.
  3. Return to the original directory and continue processing the original CMakeLists.txt file from the next line after add_subdirectory()

This setup is not specific to any IDE or text-editor. This is the whole purpose of CMake, to be a cross-platform build system generator. You simply run CMake in your chosen environment to generate the appropriate build files.