10

Is there any way to rename the various CMakeLists.txt into something more meaningful?

It can be quite distracting to have a bunch of them open at the same time when working on a bigger project that contains several CMake projects.

mattmilten
  • 6,242
  • 3
  • 35
  • 65
  • 5
    Nope, it isn't possible. Make your editor display full path or relative path to projects root along the filename. – arrowd Jul 25 '17 at 17:38
  • 1
    Too bad... Does anyone at least know *why* they chose this weird naming convention? It just sounds all kinds of wrong to me. – mattmilten Jul 25 '17 at 20:40

2 Answers2

9

There's no reasonable excuse that CMake doesn't use a specified file extension like every other tool in the toolkit. You can do this by putting a dummy CMakeLists.txt, which contains:

cmake_minimum_required(VERSION 3.8)
INCLUDE("meaningfulFilename.cmake")

Then put your actual cmake code in the .cmake file.

Roderick
  • 1,205
  • 11
  • 24
  • 2
    i fully agree, i do not accept uppercase naming for configuration files, makes it harder on the console – Erdinc Ay Jul 14 '19 at 19:28
  • 4
    @er Just put this into your `~/.inputrc`: `set completion-ignore-case On` to improve your console experience. – mattmilten Aug 20 '19 at 09:58
1

No, it's not possible. The name is meaningful, you will get used to it.

Rationale: CMake must find the files, the common choice is the related files have a common name and CMake will look for it in every folder. Make (Makefile) and Autotools (e.g. Makefile.am) chose similar.

Alternative approaches would be to configure the file name project wide (your problem would remain) or indicating the file names in the file in the parent directory (error prone).

usr1234567
  • 21,601
  • 16
  • 108
  • 128
  • 2
    No you could just configure it on the directory and all "add_subdirectory()" might look for a different name, for example to add "AndroidCMakeLists.txt" or "LinuxCMakeLists.txt" – Lothar Mar 30 '21 at 17:16