Appending to CMAKE_C_FLAGS

后端 未结 3 1926
谎友^
谎友^ 2021-02-18 22:22

I\'m using CMake for a project that comes in two versions, one of which requires -lglapi and the other does not.

So far the lines we used look like that:



        
3条回答
  •  梦谈多话
    2021-02-18 22:57

    Try to do this instead:

    if(SINGLE_MODE)
        SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -lglapi")
        SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lglapi")
    endif(SINGLE_MODE)
    

    Then, you are sure you append -lglapi to the existing ${CMAKE_CXX_FLAGS} string. Else, looks like something like a CMake list is being created.

提交回复
热议问题