# How to change the xcode target source directory name?

**URL:** <https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435>\
**Category:** Code\
**Tags:** gen:xcode\
**Created:** [November 5, 2021, 10:57pm UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435 "2021-11-05T22:57:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Princekin](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Post date:** [November 5, 2021, 10:57pm UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435/1 "2021-11-05T22:57:17Z")

</div>

Hi:  
I have a c project organized by CMake, I generated an Xcode project success based on it, Here is my c project directory Level

```auto
├── libs
│ ├── pthread
│ ├── uview
│ ├── xcrt
│ ├── xlibc
│ └── xlibcpp

```

the `libs` is parent directory, the `pthread` `uview ` `xcrt ` `xlibc` `xlibcpp` are subdirectory, I add `pthread` `uview ` `xcrt ` `xlibc` `xlibcpp` as a static libray into cmake use `add_library`, everything worked well,when I open generated xcode project,the xcode target `pthread` `uview ` `xcrt ` `xlibc` `xlibcpp` have independent source directory in xcode,but I want to add `pthread` `uview ` `xcrt ` `xlibc` `xlibcpp` into `libs` directory that they have same parent directory,what should I do? thanks!

---

<div class="post-metadata">

**Author:** ![Princekin](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Post date:** [November 5, 2021, 11:04pm UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435/2 "2021-11-05T23:04:21Z")

</div>

the generated Xcode project directory level which I want should be organized like this:

```auto
├── libs
│ ├── pthread
│ ├── uview
│ ├── xcrt
│ ├── xlibc
│ └── xlibcpp

```

---

<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 6, 2021, 1:48am UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435/3 "2021-11-06T01:48:39Z")

</div>

I think you want the [`FOLDER`](https://cmake.org/cmake/help/latest/prop_tgt/FOLDER.html) target property.

```cmake
set_property(TARGET pthread PROPERTY FOLDER libs/pthread)

```

---

<div class="post-metadata">

**Author:** ![Princekin](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/p/a8b319/32.png) [@Princekin](https://discourse.cmake.org/u/Princekin)\
**Post date:** [November 6, 2021, 2:29am UTC](https://discourse.cmake.org/t/how-to-change-the-xcode-target-source-directory-name/4435/4 "2021-11-06T02:29:19Z")

</div>

base your answer, I added:

```auto
set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
define_property(
    TARGET
    PROPERTY FOLDER
    INHERITED
    BRIEF_DOCS "Set the folder name."
    FULL_DOCS "Use to organize targets in an IDE."
)

```

after that, I generate the Xcode project using CMake again, it worked perfectly, thanks a lot!
