¶ 传入宏定义
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()