How to change output directory for a target

前端 未结 7 1814
执笔经年
执笔经年 2020-12-13 12:12

I am using a workspace where I have a main app project and then a static library project which is used by the main app. I want static library project to spit out libX.a into

7条回答
  •  伪装坚强ぢ
    2020-12-13 12:46

    Here's a solution you can check into source control, and which I've verified works with Xcode 6.2.

    1. Add a .xcconfig file to your project - see this SO question for details.
    2. In the .xcconfig file, specify the Xcode standard environment variables PROJECT_TEMP_DIR, CONFIGURATION_BUILD_DIR, and BUILT_PRODUCTS_DIR to point to where you want files to wind up.

    Reading Apple's xcconfig format reference, it would seem that simply overriding OBJROOT and SYMROOT in the .xcconfig file would do the trick - but in my testing on Xcode 6.2, changing them has no effect. You have to change those three specific environment variables listed above.

    This is what I put in an Xcode 6.2 .xcconfig file so intermediate files and executables go into their "traditional" locations:

    // Intermediate build files go here
    PROJECT_TEMP_DIR = $(SRCROOT)/build/$(PROJECT_NAME).build
    
    // Build-related files for the active build configuration go here
    CONFIGURATION_BUILD_DIR = $(SRCROOT)/build/$CONFIGURATION
    
    // The final product executables and other build products go here
    BUILT_PRODUCTS_DIR = $(SRCROOT)/build/$CONFIGURATION
    

    Don't forget to add the xcconfig file to a Deployment Target -> Configurations to make it work (Click on the Project, Under Info, in the Deployment Target Section under Configurations

提交回复
热议问题