Skip to content
This repository was archived by the owner on Jun 26, 2019. It is now read-only.
This repository was archived by the owner on Jun 26, 2019. It is now read-only.

ome-files does not correctly load dependencies when imported in CMake #85

@seanwarren

Description

@seanwarren

I'm trying to integrating ome-files in a CMake C++ project. In my hands, the following is a minimal CMakeLists.txt to successfully build a ome-files project. I am building on macOS 10.12.6 with clang 4.0.

cmake_minimum_required(VERSION 3.9)
project(ome-test) 

set(CMAKE_CXX_STANDARD 11)

set(CMAKE_PREFIX_PATH "$ENV{OME_FILES_ROOT}")

find_package(Boost COMPONENTS log iostreams) # <- Build fails without this line
find_package(OMEXML REQUIRED)
find_package(OMEFiles REQUIRED)

include_directories($ENV{OME_FILES_ROOT}/include)
add_executable(ome-test main.cpp)
target_link_libraries(ome-test OME::Files)

If I exclude the find_package(Boost COMPONENTS log iostreams) line (or use different boost components) CMake fails with the following error:

CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Threads::Threads" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::log_setup" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::log" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?


CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::iostreams" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?

[SNIP]

CMake Error at CMakeLists.txt:14 (add_executable):
  Target "ome-test" links to target "Boost::filesystem" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?

As far as I understand, find_package(OMEFiles REQUIRED) should automatically import its dependencies and this line should not be required. This error occurs when using either the downloaded ome-files build or when using a freshly compiling super-build from head.

I have the build working now but thought I'd let you know as it look a while to figure this out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions