2

In a CLI, we can do:

cmake -DCMAKE_BUILD_TYPE=Debug -Bbuild -S./directory

But how can I output build files using CMakeLists.txt?

stunicks
  • 45
  • 6
  • What do you mean by "output build files"? If you want to construct path under build directory, then `${CMAKE_BINARY_DIR}` denotes path of the build directory. – Tsyvarev Nov 09 '21 at 07:03
  • Are you asking how can we output the list of build files generated by CMake? – kiner_shah Nov 09 '21 at 07:19
  • @kiner_shah yes but in a sub directory – stunicks Nov 09 '21 at 07:23
  • Sorry, I still don't understand the question. Could you add to the question post some (pseudo-)code with explanations what it is intended to do? – Tsyvarev Nov 09 '21 at 07:37
  • @Tsyvarev Yes ```${CMAKE_BINARY_DIR}``` is the path location of your CMakeLists.txt. But I want cmake to create a directory "build" and generate all the output files into that directory. Is there any way you can write that in CMakeLists.txt? – stunicks Nov 09 '21 at 07:44
  • 1
    No, you cannot adjust build directory inside `CMakeLists.txt`. See [duplicate question](https://stackoverflow.com/questions/20834596/specifying-build-directory-within-cmakelists-file) for more info. – Tsyvarev Nov 09 '21 at 07:47

0 Answers0