I added a configuration (adhoc) for my Xcode Project(assume the name is Flurry) and I want to add a GCC_PREPROCESSOR_DEFINITIONS
to that configuration like DEBUG.I did that by pro_install hook.I added the following code :
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == "Adhoc"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC=1"
end
end
end
end
Because I use the cocoapods 0.38.2,So I need to use pods_project
instead of project
.
The Code works well on the targets that generated by cocoapods,like the AFNetworking, Pods-Flurry and all the third-party frameworks. But it didn't do any change to my project ,Flurry.So the preprocessor marco ADHOC didn't not working when I use the following code:
#ifdef ADHOC
NSLog(@"do something here");
#endif
So , How can I add a preprocessor marco the my adhoc configuration by using post_install hook.
BTW,the code below work on older version,like 0.37.1:
There is only one difference pods_project and project
post_install do |installer|
installer.project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == "Adhoc"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << "ADHOC=1"
end
end
end
end