Tool-CMake-list
https://www.visgraf.impa.br/seminar/slides/rodlima_cmake_presentation.pdf
- Useful to manage long list of elements
- Elements can be manipulated depending on running platform
- Useful for source file lists
- Example:
set(sources viewer.cpp config.cpp)
if(WIN32)
list(APPEND sources viewer_mfc.cpp)
elseif(UNIX)
list(APPEND sources viewer_gtk.cpp)
else
message(FATAL “Platform not supported”)
endif()
add_executable(viewer ${sources})
list(LENGTH sources srclen)
message(“${srclen} source files”)
foreach(src ${sources})
message(“Source: ${src}”)
endforeach()
标签:CMake,viewer,Tool,list,sources,cpp,message
From: https://www.cnblogs.com/yongchao/p/17363956.html