Fix cmake code to use our own pcre header file on Mac OS X.

The previous code didn't add the include directory from the externals
if cmake was invoked a second time.
Fix mismatching if()/endif() conditional in cmake file.