Complelety new to CMake.
I am getting following error : add_library cannot create target "hello-pack" because another target with the same name already exists.
My directory structure are as such :
my app uses two libs : hello-pack and hello-world-pack.
hello-world-pack depends upon hello-pack too to deliver its functionality.
myapp2 CMakeLists.txt file content is as such :
cmake_minimum_required(VERSION 3.4.1)
project("myapp2" C)
add_subdirectory("hello-pack")
add_subdirectory("hello-world-pack")
add_executable("${PROJECT_NAME}" myapp2.c)
target_include_directories("${PROJECT_NAME}"
PRIVATE "hello-pack/include"
PRIVATE "hello-world-pack/include")
target_link_libraries("${PROJECT_NAME}" "hello-pack" "hello-world-pack")
target_link_directories("${PROJECT_NAME}"
PRIVATE "hello-pack"
PRIVATE "hello-world-pack")
Here is the git repo for this code: https://github.com/anuragvohraec/myapp2.git
hello-pack prints out: hello!
and hello world prints out: hello! world!
I wanted to simulate a situation where in my main app and a dependent library uses a common package for building.