CMake : multiple subprojects using the same static library

A simple solution is to guard the add_subdirectory calls in both the client and the server CMake list file with an if using a TARGET conditional, i.e.:

if (NOT TARGET plugin)
    add_subdirectory("${CMAKE_SOURCE_DIR}/common/libplugin")
endif() 

This prevents the libplugin sub-directory from being added more than once.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)