Take a look at add_custom_target and add_dependencies in the CMake documentation. You can add a group as a custom goal with the goals you want to create as a dependency for the group.
http://www.cmake.org/cmake/help/v3.2/command/add_custom_target.html http://www.cmake.org/cmake/help/v3.2/command/add_dependencies.html
EDIT (after @ms comment)
You can do
add_custom_target(<group-name> DEPENDS <target1> <target2> ...)
Here is a small example.
hello1.cpp
#include <stdio.h> int main() { printf("Hello World 1\n"); return 0; }
hello2.cpp
#include <stdio.h> int main() { printf("Hello World 2\n"); return 0; }
hello3.cpp
#include <stdio.h> int main() { printf("Hello World 3\n"); return 0; }
CMakeLists.txt
cmake_minimum_required(VERSION 2.6 FATAL_ERROR) project(groups_demo) add_executable(hello1 hello1.cpp) add_executable(hello2 hello2.cpp) add_executable(hello3 hello3.cpp) add_custom_target(hello12 DEPENDS hello1 hello2) add_custom_target(hello23 DEPENDS hello3 hello2) add_custom_target(hello13 DEPENDS hello1 hello3)
Now you can use make hello12 to build hello1 and hello2
source share