XCode 7 Custom Templates: Change Build Settings

282 views Asked by At

I am creating a custom XCode project template following this tutorial.

I am able to set build settings with FRAMEWORK_SEARCH_PATHS but its not working with GCC_PREFIX_HEADER or LD_RUNPATH_SEARCH_PATHS. I tried many different solutions but its not working for any flag except FRAMEWORK_SEARCH_PATHS.

Please correct me if I am doing anything wrong here. Thanks in advance!!

Here is what I've done so far.

// Working

<key>Targets</key>
<array>
        <dict>
        <key>SharedSettings</key>
        <dict>
            <key>FRAMEWORK_SEARCH_PATHS</key>
            <array>
                <string>$(PROJECT_DIR)</string>
            </array>
        </dict>
    </dict>
</array>

// Not working

<key>Targets</key>
<array>
        <dict>
        <key>SharedSettings</key>
        <dict>
            <key>LD_RUNPATH_SEARCH_PATHS</key>
            <array>
                <string>$(inherited)</string>
                <string>Users/Name/Desktop/MyFrameworkDirectory</string>
            </array>
        </dict>
    </dict>
</array>

// Not working

<key>Targets</key>
<array>
        <dict>
        <key>SharedSettings</key>
        <dict>
            <key>GCC_PRECOMPILE_PREFIX_HEADER</key>
            <true/>
            <key>GCC_PREFIX_HEADER</key>
            <string>MyFile.pch</string>
        </dict>
    </dict>
</array>
1

There are 1 answers

0
Mohshin Shah On
            <key>SharedSettings</key>
        <dict>
            <key>GCC_PRECOMPILE_PREFIX_HEADER</key>
            <string>YES</string>
            <key>GCC_PREFIX_HEADER</key>
            <string>___PACKAGENAME___/MyFile.pch</string>
        </dict>

Use this syntax instead.

And for the LD_RUNPATH_SEARCH_PATHS you should use one of the executables from Please Click here or Apple's Doc.

For Example, I have Used @executable_path (@loader_path will also work)

        <key>LD_RUNPATH_SEARCH_PATHS</key>
        <string>$(inherited) @executable_path/Frameworks @executable_path/../Frameworks</string>