Reputation: 2508
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?
Upvotes: 4
Views: 7379
Reputation: 564
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 ..
Upvotes: 3