cmake 同时编译多个cpp文件
cmake_minimum_required(VERSION 2.8) project(coding) file(GLOB_RECURSE EXTRA_FILES */*) add_custom_target(${PROJECT_NAME}_OTHER_FILES ALL WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} SOURCES ${EXTRA_FILES}) file(GLOB_RECURSE code_sources "src/*.cpp") foreach(code_src ${code_sources}) get_filename_component(mexecutable ${code_src} NAME_WE) add_executable(${mexecutable} ${code_src}) endforeach()
一篇博客很好: