我有以下项目结构:

ProjectRoot
|           CMakeLists.txt
+---tests
|           CMakeLists.txt
+---tinyxml2
|           CMakeLists.txt
+---transaction
|           CMakeLists.txt
+---xmlGenerator
\-      CMakeLists.txt

根cmakelist是:

cmake_minimum_required(VERSION 2.4)
project(customProject)


include_directories(tinyxml2 transaction)

add_subdirectory(tinyxml2)
add_subdirectory(transaction)
add_subdirectory(tests)
add_subdirectory(xmlGenerator)

tinyxml2 CmakeLists.txt由库作者提供 . 事务CMakeLists.txt是:

add_library(product product.cpp product.h)

add_library(transaction transaction.cpp transaction.h)

测试CMakeLists.txt是:add_executable(market_lib_test test.cpp)

target_link_libraries (market_lib_test tinyxml2static product transaction )

并且xmlGenerator CMakeLists.txt是:add_executable(generator generator.cpp)

target_link_libraries(generator product tinyxml2static)

CMake运行没有错误,但是当我尝试在visual studio中编译生成器目标时,我得到以下结果:

错误1错误LNK1104:无法打开文件'.. \ transaction \ Debug \ product.lib'C:\ Users \ username \ Projects \ customProject \ build \ xmlGenerator \ LINK generator

我究竟做错了什么?