Maybe stupid question, but how do I change directory where cmake files gonna be created, so I can keep my project kinda cleaner.
For example when I run cmake -S. -B./src it is not gonna create files and directories like cmakeChache, cmakefiles and other in my source directory.
Btw I running linux.
CodePudding user response:
The syntax is:
cmake -S <PATH/TO/SOURCE_FILES> -B <PATH/TO/BUILD_OUTPUT>
cmake --build <PATH/TO/BUILD_OUTPUT> --target all
It is recommended that <PATH/TO/BUILD_OUTPUT> is not a sub directory of <PATH/TO/SOURCE_FILES>.
It should be parallel to the sources:
-PATH
-TO
-BUILD_OUTPUT
-otherstuff
-SOURCE_FILES
Note: Most CMS(e.g. git) can be configured to not consider generated files.
CodePudding user response:
I understood how to do it. I just had CMakeLists.txt file and my source c code in another directories and I don't know how to set source path to CMakeLists.txt file and c source in the same time so I just moved CMakeLists.txt file to source directory and now I don't have to set build path to path of my source code.
