Mochan
Mochan

Reputation: 1369

CMake use a different file than CMakeLists.txt

Is there a way to specify to CMake that I want to use a different file than CMakeLists.txt? I can't seem to find anything.

The problem I'm facing is that I am not allowed to check in changes made to CMakeLists.txt. I also switch branches often.

I want to modify a few build preferences for my development. If I edit CMakeLists.txt, git will not allow me to switch branches.

If I had CMyMakeLists.txt that cmake could use, then it would solve this problem. Is there a way to do this?

Upvotes: 8

Views: 3816

Answers (1)

Mochan
Mochan

Reputation: 1369

What I ended up doing was making a sub-directory called mymake and then copying the CMakeLists.txt file on to there. I then changed all the file references by prepending ..\ to them.

I then made the changes to the cmake file that I needed.

I couldn't find a way to get CMake to change directory one step up. It was a pain adding all the files to have ..\ but it solves the problem for me for the time being.

Upvotes: 1

Related Questions