Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake use a different file than CMakeLists.txt

Tags:

cmake

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?

like image 386
Mochan Avatar asked Oct 30 '18 16:10

Mochan


Video Answer


1 Answers

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.

like image 124
Mochan Avatar answered Dec 05 '22 22:12

Mochan