0

I have the following line in CMakeLists.txt:

set (BUILD_SHARED_LIBS yes CACHE BOOL "Build shared library or not")

In the GUI, this would allow (I assume) unchecking the box after initially running CMake. However, I need to be able to disable building shared libs from the command line. How can I override BUILD_SHARED_LIBS from the command line?

xaav
  • 7,876
  • 9
  • 30
  • 47
  • Add -DBUILD_SHARED_LIBS=no to your CMake call?! – usr1234567 Oct 08 '17 at 04:51
  • Does set define the variable if it's already defined? – xaav Oct 08 '17 at 05:21
  • I'd say yes, but I guess that if your set command is executed afterwards, it might get overwritten. – usr1234567 Oct 08 '17 at 05:25
  • That's the point. It's not my project it's someone else's that I'm using as a library. – xaav Oct 08 '17 at 05:26
  • It's not really a duplicate, because you need to modify the CMakeLists.txt. But it looks like that is probably the only solution, and there are enough unanswered questions to go around. – xaav Oct 08 '17 at 19:47

0 Answers0