# 3.28RC3 and xcframeworks

**URL:** https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347
**Category:** Usage
**Created:** [November 2, 2023, 6:44pm UTC](https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347 "2023-11-02T18:44:09Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Emanuele\_Zattin](https://discourse.cmake.org/user_avatar/discourse.cmake.org/emanuele_zattin/32/3971_2.png) [@Emanuele\_Zattin](https://discourse.cmake.org/u/Emanuele_Zattin)
#### Post date: [November 2, 2023, 6:44pm UTC](https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347/1 "2023-11-02T18:44:09Z")

</div>

I’ve been trying out the 3.28RC3 and to me it looks like building against xcframeworks is not really working yet. I built a minimal project using a prebuilt xcframework and I tried building against it both directly specifying the path to the xcframework in add\_library, creating an imported target and setting its IMPORTED\_LOCATION property or using find\_library. In all cases compiling the C++ file that uses the framework does not work since the include folder does not seem to be added the the compilation command.

Here’s the simple test file I’m using:

```auto
#include <opencv2/opencv.hpp>

int foo() {
    cv::Mat img = cv::imread("input.jpg");
    if (img.empty()) {
        printf("Could not open or find the image\n");
        return -1;
    }
    cv::Mat img_gray;
    cv::cvtColor(img, img_gray, cv::COLOR_BGR2GRAY);
    cv::imwrite("output.jpg", img_gray);
    return 0;
}

```

And here’s the CMakeLists.txt file:

```auto
cmake_minimum_required(VERSION 3.28)
project(GrayscaleConverter LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 14)

add_library(OpenCV SHARED IMPORTED)
set_target_properties(OpenCV PROPERTIES IMPORTED_LOCATION <PATH_TO_THE_FILE>/opencv2.xcframework)

add_library(GrayscaleConverter STATIC foo.cc)

target_link_libraries(GrayscaleConverter OpenCV)

install(TARGETS GrayscaleConverter DESTINATION lib)

```

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [November 2, 2023, 9:25pm UTC](https://discourse.cmake.org/t/3-28rc3-and-xcframeworks/9347/2 "2023-11-02T21:25:50Z")

</div>

@kyle.edwards
