[CMake] install(EXPORT "XXXTargets" ...) includes target "XXX" which requires target "caffe2_library"...
Mario Emmenlauer
mario at emmenlauer.de
Tue Mar 5 10:28:48 EST 2019
Does someone know how to generate these missing targets or how to
fix this?
Thanks for any help!
All the best, Mario
On 03.03.19 11:28, Mario Emmenlauer wrote:
>
> Dear all,
>
> I'm trying to build a C++ project based on PyTorch with cmake package
> configuration files. The includes and libs generally seem to work after
> doing:
>
> find_package(Torch 1.0.0 REQUIRED)
>
> But when I try to generate package configuration for my library, cmake
> shows an error:
> CMake Error: install(EXPORT "XXXTargets" ...) includes target "XXX" which requires target "caffe2_library" that is not in the export set.
>
> I read a number of suggestions but they refer to the case where
> "caffe2_library" would be one of my generated targets. I tried to
> generate a target for "caffe2_library" and failed, and now I'm a
> bit at a loss. Can someone lend me a hand?
>
>
> Here is a cropped version of my CMakeLists.txt:
>
> cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
> project(XXX VERSION 1.0.0)
> find_package(Torch 1.0.0 REQUIRED)
> add_library(${PROJECT_NAME} include/XXX.hh src/XXX.cc)
>
> target_include_directories(${PROJECT_NAME}
> PRIVATE
> ${CMAKE_CURRENT_SOURCE_DIR}/src
> ${CMAKE_CURRENT_BINARY_DIR}
> PUBLIC
> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
> $<INSTALL_INTERFACE:include>
> ${TORCH_INCLUDE_DIRS})
>
> target_link_libraries(${PROJECT_NAME}
> PUBLIC
> ${TORCH_LIBRARIES})
>
> export(TARGETS ${PROJECT_NAME} FILE cmake/${PROJECT_NAME}Targets.cmake)
> export(PACKAGE ${PROJECT_NAME})
>
> install(TARGETS ${PROJECT_NAME}
> EXPORT ${PROJECT_NAME}Targets
> ARCHIVE DESTINATION lib
> LIBRARY DESTINATION lib
> RUNTIME DESTINATION bin
> INCLUDES DESTINATION include)
>
> install(EXPORT ${PROJECT_NAME}Targets
> DESTINATION lib/cmake/)
>
>
> All the best,
>
> Mario Emmenlauer
>
Viele Gruesse,
Mario Emmenlauer
--
BioDataAnalysis GmbH, Mario Emmenlauer Tel. Buero: +49-89-74677203
Balanstr. 43 mailto: memmenlauer * biodataanalysis.de
D-81669 München http://www.biodataanalysis.de/
More information about the CMake
mailing list