title: CMakeLists add_subdirectory multiple times not working
body: <p>I am trying to figure out how to setup something like the following:</p>
  <pre><code>- ProjectA/
     - CMakeLists.txt
  
  - ProjectB/
     - CMakeLists.txt
       - add_subdirectory(../ProjectA ${CMAKE_CURRENT_BINARY_DIR}/ProjectA)
  
  - ProjectC/
    - CMakeLists.txt
      - add_subdirectory(../ProjectA ${CMAKE_CURRENT_BINARY_DIR}/ProjectA)
      - add_subdirectory(../ProjectB ${CMAKE_CURRENT_BINARY_DIR}/ProjectB)
  
  </code></pre>
  <p>Where each project directory is meant to be a standalone project/application/library</p>
  <p>The error I get is <em>add_library cannot create target &quot;ProjectA&quot; because another target with the same name already exists</em></p>
  <p>Within ProjectA/CMakeLists.txt it looks like</p>
  <pre><code>cmake_minimum_required(VERSION 3.0)
  project(ProjectA)
  add_library(ProjectA
     src/some_source_file.c)
  
  target_include_directories(ProjectA PUBLIC include)
  </code></pre>
  <p>ProjectC and ProjectB are similar with the added call to <code>target_link_libraries(ProjectC ProjectA)</code></p>
  <p>ProjectC works if I remove the add_subdirectory(ProjectA) <strong>in ProjectB/CMakeLists.txt</strong></p>
  <p>Is there way I can setup my cmake system to support this type of structure?</p>
  <p>I have been trying stuff like this in each project that uses ProjectA</p>
  <pre><code>if(NOT ProjectA) 
  add_subdirectory(ProjectA)
  endif()
  </code></pre>
  <p>But does not appear to work</p>