I've got two executables both of which need to be linked to N libraries which are the same:
add_executable(MyExe1 main1.cpp) add_executable(MyExe2 main2.cpp) target_link_libraries(MyExe1 lib1 lib2 lib3 ... libN) target_link_libraries(MyExe2 lib1 lib2 lib3 ... libN) So I have to write target_link_libraries twice; once for MyExe1 and once for MyExe2. Is there any way to shorten the way some common libraries are linked to two different executables? I am wondering if it's possible to link lib1 ... libN libraries to both MyExe1 and MyExe2 in one command to avoid redundancy and make the CMake file cleaner.