Skip to content

[Static] Target "ociotest" links to target "sampleicc::sampleicc" and "utils::strings", but the target was not found.  #1581

@PhoebeHui

Description

@PhoebeHui

Hi Guys,

Related to microsoft/vcpkg#21642, the user encountered the following failure when use opencoloio with static build, we noticed that target sampleicc::sampleicc and utils::strings exported in static build, but these looks private which can't be used and exported externally. we could repro this issue on windows. Could you please help take a look?

OpenColorIOTargets.cmake:

set_target_properties(OpenColorIO::OpenColorIO PROPERTIES
  INTERFACE_COMPILE_FEATURES "cxx_std_11"
  INTERFACE_LINK_LIBRARIES "OpenColorIO::OpenColorIOHeaders;\$<LINK_ONLY:expat::expat>;\$<LINK_ONLY:Imath::Imath>;\$<LINK_ONLY:pystring::pystring>;\$<LINK_ONLY:sampleicc::sampleicc>;\$<LINK_ONLY:utils::strings>;\$<LINK_ONLY:yaml-cpp>"
)

Failures:

CMake Error at /Users/matt/vcpkg/scripts/buildsystems/vcpkg.cmake:540 (_add_executable):
  Target "ociotest" links to target "sampleicc::sampleicc" but the target was
  not found.  Perhaps a find_package() call is missing for an IMPORTED
  target, or an ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:11 (add_executable)

CMake Error at /Users/matt/vcpkg/scripts/buildsystems/vcpkg.cmake:540 (_add_executable):
  Target "ociotest" links to target "utils::strings" but the target was not
  found.  Perhaps a find_package() call is missing for an IMPORTED target, or
  an ALIAS target is missing?
Call Stack (most recent call first):
  CMakeLists.txt:11 (add_executable)

Repro steps:

  1. git clone https://github.com/PhoebeHui/vcpkg
  2. cd vcpkg
  3. git checkout dev/Phoebe/opencolorio
  4. ./bootstrap-vcpkg.bat
  5. ./vcpkg install opencolorio:x64-windows-static
  6. ./vcpkg integrate install, copy the '-DCMAKE_TOOLCHAIN_FILE=xxxx', it will be used in test steps.
  7. Create a test project that will link with OpenColorIO:
    test\CMakeLists.txt
    cmake_minimum_required(VERSION 3.22)
    project(ocio-test LANGUAGES CXX)
    
    set(CMAKE_CXX_STANDARD 14)
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_EXTENSIONS OFF)
    
    find_package(OpenColorIO REQUIRED)
    add_executable(ociotest    main.cpp)
    
    target_link_libraries(ociotest PRIVATE OpenColorIO::OpenColorIO OpenColorIO::OpenColorIOHeaders)
    

test\main.cpp
```
#include <OpenColorIO/OpenColorIO.h>

int main()
{
  OCIO_NAMESPACE::Config::CreateFromEnv();
  return 0;
}
```
  1. Create test\build folder, replace the '-DCMAKE_TOOLCHAIN_FILE=E:/vcpkg/PhoebeHui/vcpkg/scripts/buildsystems/vcpkg.cmake' with your actual path. Then execute the command:
cmake.exe  -DCMAKE_TOOLCHAIN_FILE=E:/vcpkg/PhoebeHui/vcpkg/scripts/buildsystems/vcpkg.cmake  -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_BUILD_TYPE=debug -G "Visual Studio 16 2019" ..

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