cmake ignores -D CMAKE_BUILD_TYPE=Debug

前端 未结 3 1893
夕颜
夕颜 2021-02-19 08:28

I\'m just trying to build a cmake project in debug-mode to enable asserts. I tried the following versions:

cmake -D CMAKE_BUILD_TYPE:STRING=Debug -L ../../
cmake         


        
3条回答
  •  你的背包
    2021-02-19 09:07

    Ok, fgrep -R "CMAKE_BUILD_TYPE" finally found the problem for me. In some CMakeLists.txt-file I found something like that:

    SET( CMAKE_BUILD_TYPE Release ... FORCE )
    

    That overrides every user defined parameters (because of the FORCE).

    What works for me is that:

    IF( NOT CMAKE_BUILD_TYPE )
       SET( CMAKE_BUILD_TYPE Release ... FORCE )
    ENDIF()
    

    Thank's for your hints!

提交回复
热议问题