cmake:设置编译选项的讲究(add_compile_options和CMAKE_CXX_FLAGS的区别)
Cmake中
关于function macro参数中使用list的调用:
错误 Code:
macro( FindLibs LIBRARY_NAMES_LIST )
message( "inside ${LIBRARY_NAMES_LIST}" )
endmacro()
set( LIBRARY_NAMES_LIST lib1 lib2 lib3)
message( "outside ${LIBRARY_NAMES_LIST}" )
FindLibs(${LIBRARY_NAMES_LIST})
Output:
message( "outside lib1 lib2 lib3" )
message( "inside lib1" )
正确:
FindLibs("${LIBRARY_NAMES_LIST}")