cmake学习笔记

阅读量: searchstar 2023-03-14 15:02:15
Categories: Tags:

传入宏定义

option(MACRO_NAME
    “Descriptions of the macro”
    OFF)
if (MACRO_NAME)
  add_compile_definitions(MACRO_NAME)
endif ()

然后cmake .. -DMACRO_NAME=ON,再make就好了。

find_library

https://stackoverflow.com/questions/29657195/how-to-test-if-cmake-found-a-library-with-find-library

find_library(LUA_LIB lua)
if(NOT LUA_LIB)
  message(FATAL_ERROR "lua library not found")
endif()

message

https://cmake.org/cmake/help/latest/command/message.html