cmake中所有的对象都是string,所以我们对这些的操作就是对字符串的操作,里面提供追加和删除的方法
CMakeLists.txt
cmake_minimum_required(VERSION 3.15) project(test) # 方式二 file(GLOB SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp) message("=========================") message(${SRC}) list(REMOVE_ITEM SRC ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp) message("=========================") message(${SRC}) # 添加头文件 include_directories(${PROJECT_SOURCE_DIR}/include) # set(EXECUTABLE_OUTPUT_PATH ../output) set(CMAKE_CXX_STANDARD 11) # 生成依赖库文件路径 set(LIBRARY_OUTPUT_PATH ../share) # add_executable(app ${SRC}) # add_library(calc STATIC ${SRC}) set(tmp hello world) set(tmp1 ${tmp} ${SRC}) message(${tmp}) message(${tmp1}) list(APPEND tmp "xxxx") message(${tmp})
标签:tmp,SRC,set,cmake,list,message From: https://www.cnblogs.com/xiaoruirui/p/17656678.html