How to set a CMake option() at command line

后端 未结 3 411
情歌与酒
情歌与酒 2020-12-07 13:01

I created a CMakeLists.txt that contains the following

project(P4V)
cmake_minimum_required(VERSION 2.6)

option(BUILD_STATIC_LIBS \"Build the static library\         


        
相关标签:
3条回答
  • 2020-12-07 13:24

    An additional option is to go to your build folder and use the command ccmake .

    This is like the GUI but terminal based. This obviously won't help with an installation script but at least it can be run without a UI.

    The one warning I have is it won't let you generate sometimes when you have warnings. if that is the case, exit the interface and call cmake .

    0 讨论(0)
  • 2020-12-07 13:30

    Delete the CMakeCache.txt file and try this:

    cmake -G %1 -DBUILD_SHARED_LIBS=ON -DBUILD_STATIC_LIBS=ON -DBUILD_TESTS=ON ..
    

    You have to enter all your command-line definitions before including the path.

    0 讨论(0)
  • 2020-12-07 13:39

    this works for me:

    cmake -D DBUILD_SHARED_LIBS=ON DBUILD_STATIC_LIBS=ON DBUILD_TESTS=ON ..
    
    0 讨论(0)
提交回复
热议问题