I have a project with two CMakeLists.txt files: CMakeLists.txt (default) and CMakeLists.2.txt. So my directory tree looks like
project
|---- CMakeLists.txt
|---- CMakeLists.2.txt
|---- main.cpp
|---- otherfile.cpp
I build like:
mkdir build
cd build
cmake ..
make
This uses the default CMakeLists.txt file. How can I specify to build using the CMakeLists.2.txt cmake file?
You cannot change the file name of "CMakeLists.txt".
However, if you need different build configuration for one project, you should use the option
in cmake:
option(BUILD_STATIC_LIBS "Build the static library" ON)
option(BUILD_SHARED_LIBS "Build the shared library" ON)
option(BUILD_TESTS "Build test programs" OFF)
And build like this:
cmake -D DBUILD_SHARED_LIBS=ON DBUILD_STATIC_LIBS=OFF DBUILD_TESTS=ON ..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With