Xcodeproj icon indicating copy to clipboard operation
Xcodeproj copied to clipboard

Unable to parse build settings for 'OTHER_CFLAGS' when contains '$(inherited)'

Open menttofly opened this issue 4 years ago • 1 comments

I want to add new flag for 'OTHER_CFLAGS', however the build_settings['OTHER_CFLAGS'] return nil because the exist of '$(inherited)' flag. If I remove this flag and add other flag, everything works great and I got an array for 'OTHER_CFLAGS'. But in other cases for example 'OTHER_LDFLAGS', I got the correct result. Here is my code:

def run(project_path, repo_dir)
    project = Xcodeproj::Project.open(project_path)
    gaoding_targets = gaoding_targets(repo_dir)
    clang_flag = '-fsanitize-coverage=func,trace-pc-guard'
    
    project.targets.each do |target|
        next unless gaoding_targets.include?(target.name)
        target.build_configurations.each do |config|
            if ARGV[1] == 'use'
                config.build_settings['OTHER_CFLAGS'] = clang_flag
            else
                config.build_settings['OTHER_CFLAGS'] = ''
            end
        end
    end
    project.save
end

menttofly avatar Apr 23 '20 09:04 menttofly

same issue

VincentChow avatar Nov 18 '20 10:11 VincentChow