install(EXPORT "XXXTargets" ...) includes target "XXX" which requires target "caffe2_library"...

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

install(EXPORT "XXXTargets" ...) includes target "XXX" which requires target "caffe2_library"...

Mario Emmenlauer

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
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: install(EXPORT "XXXTargets" ...) includes target "XXX" which requires target "caffe2_library"...

Mario Emmenlauer

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/
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake