-2

I am totally new to CMake and compiled languages for that matter. I have seen this question and answer. But I still don't fully understand what CMake is.

I am coming from a nodeJs/Javascipt environment, therefore if I could know a CMake equivalent in the nodeJs/Javascipt environment it would really help me understand what it is.So... Is CMake an equivalent of npm?

YulePale
  • 6,688
  • 16
  • 46
  • 95

1 Answers1

1

No, citing from Wikipedia:

CMake is a cross-platform free and open-source software tool for managing the build process of software using a compiler-independent method. It supports directory hierarchies and applications that depend on multiple libraries. It is used in conjunction with native build environments such as Make, Qt Creator, Ninja, Apple's Xcode, and Microsoft Visual Studio. It has minimal dependencies, requiring only a C++ compiler on its own build system.

JavaScript is an interpreted language, that means NodeJS/Browsers read and understand the code and execute it directly. For example C is built via a compiler (that reads and understands the code before execution) to Machine code (that does not need to be understand because it's the native language from your processor) and can be executed faster. CMake simplifies calling the Compiler, linking libraries (something like setting up require) and more for all files. Altough sometimes using babel, webpack and others via npm run is called 'building'.

nift4
  • 58
  • 8
  • So CMake 'compiles' C++ as you code so that you don't have to compile it everytime you want to test the code? Or What is meant by: 'managing the build process of software using a compiler-independent method'? – YulePale Sep 29 '19 at 06:22
  • I think I now understand. Just to clarify Does this mean JavaScript is already in Machine code? Also from you answer you say Wikipedia says: 'CMake is a tool for managing the build process of software using a compiler-independent method'. Then you go ahead and say: 'CMake simplifies calling the Compiler'. So what is meant by: 'compiler-independent method'? – YulePale Sep 29 '19 at 06:31
  • 1
    No, JavaScript is not in Machine code, it's in JavaScript. Node.JS does not converts it to machine code first, it does it while executing – nift4 Sep 29 '19 at 07:53
  • 1
    And there are different programs to convert C(++) to Machine code. They are called compilers. CMake manages how to call the compiler, which files to convert (it would be weird if it tries on sound files of a game) and how to combine everything. – nift4 Sep 29 '19 at 07:55