diff --git a/cmPrefs.c b/cmPrefs.c index 49e9e50..c8623d6 100644 --- a/cmPrefs.c +++ b/cmPrefs.c @@ -1337,8 +1337,9 @@ cmPrRC_t _cmPrefsCreateJsonNode( pnp->id = _cmPrefsCalcNextAvailId(p); else { - if( _cmPrefsIdToNodePtr(p, id, false ) != NULL ) - cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString)); + if( existsFl == false ) + if( _cmPrefsIdToNodePtr(p, id, false ) != NULL ) + cmErrWarnMsg(&p->err,kDuplicateIdPrRC,"The preference variable id '%i' is used by multiple preference variables including '%s'.",id,cmStringNullGuard(pathString)); pnp->id = id; } diff --git a/cmPrefs.h b/cmPrefs.h index 1fd8039..9da0ab9 100644 --- a/cmPrefs.h +++ b/cmPrefs.h @@ -144,8 +144,9 @@ extern "C" { cmPrRC_t cmPrefsPathSetString( cmPrH_t h, const cmChar_t* pathStr, const cmChar_t* val ); // Create a new preference variable and set it's value to 'val'. - // If a variable with the same path and type already exists and kForceValuePrFl is set then update it's value to 'val'. - // Note that in this case if kForceValuePrFl is not set then the function returns quietly. + // If a variable with the same path and type already exists and kForceValuePrFl + // is set then update it's value to 'val'. Note that in this case if + // kForceValuePrFl is not set then the function returns quietly. // // If a variable with the same path but a different type exists then an error is returned. //